11.7 @math and @displaymath: Formatting Mathematics

You can write a mathematical expression, equation or formula using the @math command. Write the TeX math notation between braces, like this:

@math{\partial_\alpha \partial^\alpha A^\beta = \mu_0 J^\beta}

@math is formatted inline when used inside a paragraph, like \(\partial_\alpha \partial^\alpha A^\beta = \mu_0 J^\beta\) in this example. The @math command has no special effect on the Info output, merely outputting the contents verbatim.

For printed output, @math switches into TeX “math mode”. In that context, ‘\’ must be used instead of ‘@’ for plain TeX math control sequences for symbols, functions, and so on.

By default, the HTML output is only emphasized. texi2any provides three options for displaying properly formatted mathematics for HTML. You can select these with the HTML_MATH variable (see HTML Customization Variables). With HTML_MATH set to ‘l2h’, texi2any attempts to use the latex2html program to produce image files for mathematical material. With the ‘t4h’ setting, texi2any attempts to use the tex4ht program. With the ‘mathjax’ setting, texi2any inserts references in the output files to MathJax scripts to format the material. The MathJax option requires JavaScript to be enabled in the browser to work. See also MathJax Customization Variables, latex2html Customization Variables and tex4ht Customization Variables.

For displayed equations, you can use the @displaymath command. Example:

f(x) = {1\over\sigma\sqrt{2\pi}}
@end displaymath

which produces:

\[f(x) = {1\over\sigma\sqrt{2\pi}} e^{-{1\over2}\left({x-\mu\over\sigma}\right)^2} \]

In general, the contents of @math or @displaymath should be plain TeX only, with no interspersed Texinfo commands. If you do use any Texinfo commands, then you should mark these with ‘@’ as usual, rather than ‘\’ (e.g. ‘@var’ rather than ‘\var’), but we do not guarantee which Texinfo commands will work.

Although @sub and @sup may work inside math mode in some contexts, it is better to use TeX’s ‘_’ and ‘^’ characters to denote subscripts and superscripts within mathematical expressions.

LaTeX-specific code will only work when the output format is LaTeX, and with the HTML_MATH options (although tex4ht needs T4H_MATH_CONVERSION to be set to ‘latex’; see tex4ht Customization Variables).

Due to the conflict with Texinfo’s @sup command, you can access the plain TeX command \sup as \mathopsup instead, in the unlikely occurrence that you want to do this (but only when processing with TeX, not when outputting LaTeX nor with any of the HTML_MATH options).

JavaScript license information