Next: , Previous: , Up: Special Insertions   [Contents][Index]


11.7 @math and @displaymath: Formatting Mathematics

You can write a short mathematical expression with the @math command. Write the mathematical expression between braces, like this:

@math{\sin 2\pi \equiv \cos 3\pi}

which looks like this:

\(\sin 2\pi \equiv \cos 3\pi\)

The @math command has no special effect on the Info output or (by default) the HTML output, merely outputting the contents verbatim.

For the TeX output, @math switches into math mode. This allows you to use all the plain TeX math control sequences for symbols, functions, and so on, starting with ‘\’. It’s best to use ‘\’ instead of ‘@’ for any such mathematical commands; otherwise, texi2any will complain.

By default, the HTML output is only enclosed by <em>. 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 and latex2html Customization Variables.

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

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

which produces:

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

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. In general, the contents of @math or @displaymath should be plain TeX only, with no interspersed Texinfo commands.

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 with any of the HTML_MATH options).


Next: Glyphs for Text, Previous: @sub and @sup: Inserting Subscripts and Superscripts, Up: Special Insertions   [Contents][Index]

JavaScript license information