The textmacros extension adds the ability to process some text-mode macros within \text{} and other macros that produce text-mode material. See the Differences from Actual TeX section for how text-mode is handled without this extension.

This extension is not loaded automatically, and can’t be loaded via the autoload extension. To load the textmacros extension, add '[tex]/textmacros' to the load array of the loader block of your MathJax configuration, and add 'textmacros' to the packages array of the tex block.

window.MathJax = {
  loader: {load: ['[tex]/textmacros']},
  tex: {packages: {'[+]': ['textmacros']}}

Alternatively, use \require{textmacros} in a TeX expression to load it dynamically from within the math on the page, if the require package is loaded.

Available Macros:

The macros available in text mode with this extension are listed below. In addition, any macro that is defined via \def or \newcommand or in the macros section of the tex configuration block will also be processed if they only contain macros from the list below.

Additional Special Characters


non-breaking space


open quote (use two for double quote)


close quote (use two for double quote)

Math Mode Delimiters


start/end math mode


start math mode


end math mode

Quoted Special Characters


literal dollar sign


literal underscore


literal percent


literal open brace


literal close brace

\ (backslash-space)

literal space


literal ampersand


literal hash mark


literal backslash

Text Accents


acute accent


grave accent


circumflex accent


umlaut accent


tilde accent


macron accent


over dot accent


breve accent


caron accent

Font Control


emphasized text


roman text


oldstyle numerals


calligraphic text


italic text


bold text


script text


Fraktur text


sans-serif text


typewriter text


blackboard-bold text


roman text


italic text


bold text


sans-serif text


typewriter text

Size Control


very tiny size


tiny size


size of super- and subscripts


small size


standard size


large size


larger sizse


very large size


even larger size


largest size

Special Characters





Spacing Commands


thin space


medium space


medium space


thick space


negative thin space




quad space


double quad space


thin space


negative thin space


horizontal skip (by following amount)


horizontal space (of a given size)


kern (by a given size)


line of a given width and height


box with given dimensions


space with given dimensions

Color Commands


set text color


set text color


make colored box


make framed colored box

HTML Commands


make hyperlink


specify CSS styles


specify CSS class


specify CSS id


character from unicode value

Equation Numbers


cite a labeled equation


cite a labeled equation with parentheses

Additional Packages

You can configure the textmacros extension to use additional packages, just as you can specify additional math TeX packages. Normally, these should be pckages designed for text mode, but it is possible to load some of the regular TeX packages as text macros. For example

MathJax = {
  loader: {load: ['[tex]/textmacros', '[tex]/bbox']},
  tex: {
    packages: {'[+]': {'textmacros'}},
    textmacros: {
      packages: {'[+]': ['bbox']}

would make the bbox extension available in text mode, so you could use \bbox inside \text{}, for example. Not all math-mode extensions are appropriate for textmode, but some can be usefully employed in text mode.