autoload
The autoload extension predefines macros from some of the extensions that haven’t been loaded already so that they automatically load the needed extension when the macro is first used. Some exceptions are the physics package, since it redefines standard macros, and the ams package, due to the large number of macros it contains, and the fact that it is already included in most of the combined components.
Warning
Because the number of available macros is growing, new TeX extensions are not being added to autoload as they are developed, and the autoload extension may be phased out in the future. Extensions that are not auto-loaded include: ams, bbm, bboldx, begingroup, cases, centernot, colortbl, dsfont, empheq, mathtools, physics, require, setoptions, textcomp, textmacros, units, and upgreek.
The autoload extension is loaded in all the components that include
the TeX input jax, other than input/tex-base. That means that the
TeX input jax has access to many of the TeX extensions, even if they
aren’t loaded initially, and you should rarely have to use
\require or load other extensions explicitly unless you want to.
You can control which extensions autoload will load using the
autoload object in the tex block of your MathJax
configuration. This object contains key: value pairs where the
key is the name of an extension, and value is an array listing the
macro names that cause that extension to be loaded. If environments
can also cause the extension to be loaded, value is an array
consisting of two sub-arrays, the first being the names of the macros
that cause the extension to autoload, and the second being the names
of the environments that cause the extension to be loaded.
For example,
window.MathJax = {
tex: {
autoload: {
verb: ['verb']
}
}
};
says that the \verb command should load the verb
extension when it is first used.
If the array is empty, then that extension will not be loaded, so to prevent autoload from loading an extension, assign it the empty array. E.g.,
window.MathJax = {
tex: {
autoload: {
verb: []
}
}
};
says that the verb extension will not be autoloaded.
Note
The autoload extension defines \color to be the one from the
color extension (the LaTeX-compatible one rather than
the non-standard MathJax v2 version). If you wish to use the
non-standard version-2 \color macro from the colorv2
extension instead, use the following:
window.MathJax = {
tex: {
autoload: {
color: [],
colorv2: ['color']
}
}
};
The autoload extension is already loaded in all the components that
include the TeX input jax, other than input/tex-base. To load the
autoload extension explicitly (when using input/tex-base for
example), add '[tex]/autoload' to the load array of the
loader block of your MathJax configuration, and add
'autoload' to the packages array of the tex block.
window.MathJax = {
loader: {load: ['[tex]/autoload']},
tex: {packages: {'[+]': ['autoload']}}
};
Since the autoload extension is included in the combined components that contain the TeX input jax, it will already be in the package list for those components. In that case, if you want to disable it, you can remove it:
window.MathJax = {
tex: {packages: {'[-]': ['autload']}}
};
autoload Options
Adding the autoload extension to the packages array defines an
autoload sub-block to the tex configuration block. This block
contains key: value pairs where the key is a TeX package name, and
the value is an array of macros that cause that package to be loaded,
or an array consisting of two arrays, the first giving names of macros
and the second names of environments; the first time any of them are
used, the extension will be loaded automatically.
The default autoload definitions are the following:
MathJax = {
tex: {
autoload: {
action: ['toggle', 'mathtip', 'texttip'],
amscd: [[], ['CD']],
bbox: ['bbox'],
boldsymbol: ['boldsymbol'],
braket: [
'bra',
'ket',
'braket',
'set',
'Bra',
'Ket',
'Braket',
'Set',
'ketbra',
'Ketbra',
],
bussproofs: [[], ['prooftree']],
cancel: ['cancel', 'bcancel', 'xcancel', 'cancelto'],
color: ['color', 'definecolor', 'textcolor', 'colorbox', 'fcolorbox'],
enclose: ['enclose'],
extpfeil: [
'xtwoheadrightarrow',
'xtwoheadleftarrow',
'xmapsto',
'xlongequal',
'xtofrom',
'Newextarrow',
],
html: ['data', 'href', 'class', 'style', 'cssId'],
mhchem: ['ce', 'pu'],
newcommand: [
'newcommand',
'renewcommand',
'newenvironment',
'renewenvironment',
'def',
'let',
],
unicode: ['unicode', 'U', 'char'],
verb: ['verb'],
}
}
};
To prevent an extension from autoloading, set its value to an empty array. E.g., to not autoload the color extension, use
MathJax = {
tex: {
autoload: {
color: []
}
}
};
If you define your own extensions, and they have a prefix other than
[tex], then include that in the extension name. For instance,
MathJax = {
tex: {
autoload: {
'[extensions]/myExtension' : ['myMacro', 'myOtherMacro']
}
}
};
See the Loader Options section for details about how to define
your own prefixes, like the [extensions] prefix used here.