Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the TeX \cancel command #934

Closed
sangwinc opened this issue Mar 23, 2023 · 3 comments
Closed

Support for the TeX \cancel command #934

sangwinc opened this issue Mar 23, 2023 · 3 comments

Comments

@sangwinc
Copy link
Member

MathJax now has support for the TeX \cancel command, using https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js and

MathJax.Hub.Config({
    config: ["Accessible.js", "Safe.js"],
    errorSettings: { message: ["!"] },
    skipStartupTypeset: true,
    messageStyle: "none",
    tex: {autoload: expandable({
         action: ['toggle', 'mathtip', 'texttip'],
         amscd: [[], ['CD']],
         bbox: ['bbox'],
         boldsymbol: ['boldsymbol'],
         braket: ['bra', 'ket', 'braket', 'set', 'Bra', 'Ket', 'Braket', 'Set', 'ketbra','Ketbra'],
         cancel: ['cancel', 'bcancel', 'xcancel', 'cancelto'],
         color: ['color', 'definecolor', 'textcolor', 'colorbox', 'fcolorbox'],
         enclose: ['enclose'],
         extpfeil: ['xtwoheadrightarrow', 'xtwoheadleftarrow', 'xmapsto', 'xlongequal', 'xtofrom', 'Newextarrow'],
         html: ['href', 'class', 'style', 'cssId'],
         mhchem: ['ce', 'pu'],
         newcommand: ['newcommand', 'renewcommand', 'newenvironment', 'renewenvironment', 'def', 'let'],
         unicode: ['unicode'],
         verb: ['verb']
    })}
});

Test cases are

\( {\color{red}\cancel{\color{black}x+1}}+a \)
\( \frac{x^2{\color{red}\cancel{\color{black}(x+1)}}}{\color{red}\cancel{\color{black}(x+1)}}\)

We could also add in a Maxima function cancel which typesets its argument, and another cancelwith which cancels its first argument, and indicates a replacement with the second. E.g. cancelwith(x+1,1) in maxima might typeset as

\( \stackrel{\color{red}1}{{\color{red}\cancel{\color{black}x+1}}} \)

Is this a useful addition? Comments welcome!
Chris

@sangwinc
Copy link
Member Author

This should probably be disp_cancel to be consistent with disp_select in
Selecting, and highlighting part of an expression

@sangwinc
Copy link
Member Author

Here is a screen shot of the above two examples.
CancelExamples

@sangwinc
Copy link
Member Author

This proved problematic with the new version of MathJax so we'll shelve it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant