In his answer to a question about crossing out units in dimensional analysis, Loong notes that the \cancel{}
LaTeX command can be enabled in MathJax by using \require{cancel}
at the start of a MathJax block.
What other commands/features can be enabled in MathJax through the use of \require{}
, or other similar MathJax-internal commands?
Peter's answer points to the MathJax documentation, which lists the additional features available using \require{}
. Many of these features are sufficiently cool and potentially useful that I want to make them more visible. So, I plan to lay out the available features and examples of their usage in the answers below. For convenience, below is a table of contents—you may want to wait to click these until the page has fully loaded and all of the MathJax has rendered, otherwise the entry you want may "run away" from you:
To note, even though mhchem
has been enabled on Chem.SE by default, it is not enabled on many other sites in the Stack Exchange network. If for some reason you have need of chemical equations somewhere else and \ce
isn't rendering properly for you, including \require{mhchem}
should make it work. Per the developer's comment and chat post, though, beware that sites that do not specifically load the newest mhchem
will load whatever version is packaged with the current version of MathJax, and therefore some behavior may differ, possibly significantly.
The amsmath
and amssymbols
extensions are also enabled by default on Chem.SE. The symbols available by default, as well as those that require activation by \require{mediawiki-texvc}
, can be browsed at the relevant section of the MathJax documentation. In particular, if you are interested in using the symbol for Angstrom units, use \AA
after supplying \require{mediawiki-texvc}
:
$$ \require{mediawiki-texvc} \AA $$
Finally, note that using any of these \require{}
commands will enable the feature set for the entire webpage in which they will appear. This shouldn't be a problem for most the commands laid out here; the primary exception is \require{color}
, which will interfere with any uses of the default $\mathrm\TeX$ form of \color{}
. As such, \bbox
is preferred, when possible. There do exist a couple of additional MathJax extensions not listed above that can be loaded with \require{}
, but I've omitted them here because they will essentially always have significant side-effects beyond just the post in which they're included.
bbox
, andunicode
get loaded automatically when the\bbox
, and\unicode
macros are first used, so no need for\require
for these. Similarly, thehtml
extension is loaded by the first use of\href
,\style
,\class
, or\cssId
, so no need for\require
there, either. Also, SE's configuration already includesAMSsymbols
, so no need to include that via\require
. Finally, note that the\color
macro from thecolor
extension is incompatible with the default\color
macro, so loading that can cause problems for people used to using the default\color
macro. $\endgroup$AMSsymbols
wasn't enabled by default -- on a quick test, you're absolutely right. Will edit there, too. Thanks! $\endgroup$\color
, but it hadn't occurred that this has potential to break other users' posts -- will add a warning for that, too. $\endgroup$\AA
. I shall now go back and reedit all my relevant posts to read ångströms instead. $\endgroup$\require{mhchem}
(used at another SE site) will load the 'legacy' version from MathJax core, while chemistry.SE already uses the improved version 3. So not all input will render identical. $\endgroup$\color
-- I've never used $\TeX$ directly, so I had no idea that it was a MathJax thing, not a $\TeX$ thing. $\endgroup$