Chapter 25. Mathematical Formulas

The asciimath and latexmath passthrough macros along with asciimath and latexmath passthrough blocks provide a (backend dependent) mechanism for rendering mathematical formulas. You can use the following math markups:

[Note]

The latexmath macro used to include LaTeX Math in DocBook outputs is not the same as the latexmath macro used to include LaTeX MathML in XHTML outputs. LaTeX Math applies to DocBook outputs that are processed by dblatex and is normally used to generate PDF files. LaTeXMathML is very much a subset of LaTeX Math and applies to XHTML documents.

25.1. LaTeX Math

LaTeX math can be included in documents that are processed by dblatex(1). Example inline formula:

latexmath:[$C = \alpha + \beta Y^{\gamma} + \epsilon$]

For more examples see the AsciiDoc website or the distributed doc/latexmath.txt file.

25.2. ASCIIMathML

ASCIIMathML formulas can be included in XHTML documents generated using the xhtml11 and html5 backends. To enable ASCIIMathML support you must define the asciimath attribute, for example using the -a asciimath command-line option. Example inline formula:

asciimath:[`x/x={(1,if x!=0),(text{undefined},if x=0):}`]

For more examples see the AsciiDoc website or the distributed doc/asciimathml.txt file.

25.3. LaTeXMathML

LaTeXMathML allows LaTeX Math style formulas to be included in XHTML documents generated using the AsciiDoc xhtml11 and html5 backends. AsciiDoc uses the original LaTeXMathML by Douglas Woodall. LaTeXMathML is derived from ASCIIMathML and is for users who are more familiar with or prefer using LaTeX math formulas (it recognizes a subset of LaTeX Math, the differences are documented on the LaTeXMathML web page). To enable LaTeXMathML support you must define the latexmath attribute, for example using the -a latexmath command-line option. Example inline formula:

latexmath:[$\sum_{n=1}^\infty \frac{1}{2^n}$]

For more examples see the AsciiDoc website or the distributed doc/latexmathml.txt file.

25.4. MathML

MathML is a low level XML markup for mathematics. AsciiDoc has no macros for MathML but users familiar with this markup could use passthrough macros and passthrough blocks to include MathML in output documents.