require¶
The require extension defines the nonstandard \require
macro
that allows you to load extensions from within a math expression in a
web page. For example:
\(\require{enclose} \enclose{circle}{x}\)
would load the enclose extension, making the following
\enclose
command available for use.
An extension only needs to be loaded once, and then it is available for all subsequent typeset expressions.
This extension is already loaded in all the components that
include the TeX input jax, other than input/texbase
. To load the
require extension explicitly (when using input/texbase
for
example), add '[tex]/require'
to the load
array of the
loader
block of your MathJax configuration, and add 'require'
to the packages
array of the tex
block.
window.MathJax = {
loader: {load: ['[tex]/require']},
tex: {packages: {'[+]': ['require']}}
};
Since the require extension is included in the combined components that contain the TeX input jax, it may already be in the package list. In that case, if you want to disable it, you can remove it:
window.MathJax = {
tex: {packages: {'[]': ['require']}}
};
require Options¶
Adding the require extension to the packages
array defines a
require
subblock of the tex
configuration block with the
following values:
MathJax = {
tex: {
require: {
allow: {
base: false,
'allpackages': false
},
defaultAllow: true
}
};

allow: {...}
This subobject indicates which extensions can be loaded by
\require
. The keys are the package names, and the value istrue
to allow the extension to be loaded, andfalse
to disallow it. If an extension is not in the list, the default value is given bydefaultAllow
, described below.

defaultAllow: true
This is the value used for any extensions that are requested, but are not in the
allow
object described above. If set totrue
, any extension not listed inallow
will be allowed; iffalse
, only the ones listed inallow
(with valuetrue
) will be allowed.