STEM Formulas

Activating Formulas

Especially in science, adding formulas is essential. AsciiDoc combines simple syntax with high expressiveness for mathematical representations.

Activate the :stem: attribute in the document header:

= My Document
:stem:

You can choose between two syntax variants:

  • :stem: or :stem: asciimath – simpler, more readable syntax

  • :stem: latexmath – more powerful LaTeX syntax

Inserting Formulas

For inline formulas within running text:

Einstein's famous formula stem:[E = mc^2].

Result: Einstein’s famous formula ``E = mc^2``.

For block formulas on their own line:

[stem]
++++
x = (-b +- sqrt(b^2-4ac))/(2a)
++++

Result:

\{x = (-b +- sqrt(b^2-4ac))/(2a)\}

AsciiMath and LaTeXMath

The default AsciiMath syntax is intuitively readable:

Input Meaning

x^2

x squared

sqrt(x)

Square root of x

(a)/(b)

Fraction a/b

sum_(i=1)^n

Sum from 1 to n

int_0^1

Integral from 0 to 1

You can mix both syntaxes in the same document. Instead of stem:, simply write asciimath: or latexmath: for individual formulas:

AsciiMath: asciimath:[sum_(i=1)^n i]

LaTeX: latexmath:[\sum_{i=1}^{n} i]

AsciiMath: ``sum_(i=1)^n i``

LaTeX: \(\sum_{i=1}^{n} i\)

The adoc Coach helps you with formula syntax. Write stem in the editor and press ESC for suggestions.