Embedding LaTeX Math in AsciiDoc dblatex documents
==================================================

You can include
ftp://ftp.ams.org/pub/tex/doc/amsmath/short-math-guide.pdf[LaTeX math]
equations in AsciiDoc documents that are processed by 'dblatex'.


Inline equations
----------------
This markup:

---------------------------------------------------------------------
An inline equation latexmath:[$C = \alpha + \beta Y^{\gamma} + \epsilon$]
using the 'math' inline macro.

You can use the same 'math' macro to inject arbitrary latexmath:[\LaTeX] markup
(but beware, this is an undocumented trick).
---------------------------------------------------------------------

Renders:

An inline equation latexmath:[$C = \alpha + \beta Y^{\gamma} + \epsilon$]
using the 'math' inline macro.

You can use the same 'math' macro to inject arbitrary latexmath:[\LaTeX] markup
(but beware, this is an undocumented trick).


Informal equations
------------------
Informal (untitled) equations are generated with a 'math' style
passthrough delimited block. This markup:

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

Renders:

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

Functionally identical block macro syntax:

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

Renders:

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


Formal equations
----------------
Formal equations are titled and are generated with a 'math' style
passthrough delimited block.

This markup:

---------------------------------------------------------------------
.Unnumbered
[latexmath]
++++++++++++++++++++++++++++++++++++++++++++
\[C = \alpha + \beta Y^{\gamma} + \epsilon\]
++++++++++++++++++++++++++++++++++++++++++++
---------------------------------------------------------------------

Renders:

.Unnumbered
[latexmath]
++++++++++++++++++++++++++++++++++++++++++++
\[C = \alpha + \beta Y^{\gamma} + \epsilon\]
++++++++++++++++++++++++++++++++++++++++++++

This markup:

---------------------------------------------------------------------
.Aligned
[latexmath]
++++++++++++++++++++++++++++++++++++++++++++
\begin{align*}
2x^2 + 3(x-1)(x-2) & = 2x^2 + 3(x^2-3x+2) \\
&= 2x^2 + 3x^2 - 9x + 6 \\
&= 5x^2 - 9x + 6
\end{align*}
++++++++++++++++++++++++++++++++++++++++++++
---------------------------------------------------------------------

Renders:

.Unnumbered
.Aligned
[latexmath]
++++++++++++++++++++++++++++++++++++++++++++
\begin{align*}
2x^2 + 3(x-1)(x-2) & = 2x^2 + 3(x^2-3x+2) \\
&= 2x^2 + 3x^2 - 9x + 6 \\
&= 5x^2 - 9x + 6
\end{align*}
++++++++++++++++++++++++++++++++++++++++++++

This markup:

---------------------------------------------------------------------
.Array
[latexmath]
++++++++++++++++++++++++++++++++++++++++++++
\begin{eqnarray}
x & = & \frac{-7 \pm \sqrt{49 - 24}}{6} \\
& = & -2 \textrm{ or } -\frac13
\end{eqnarray}
++++++++++++++++++++++++++++++++++++++++++++
---------------------------------------------------------------------

Renders:

.Array
[latexmath]
++++++++++++++++++++++++++++++++++++++++++++
\begin{eqnarray}
x & = & \frac{-7 \pm \sqrt{49 - 24}}{6} \\
& = & -2 \textrm{ or } -\frac13
\end{eqnarray}
++++++++++++++++++++++++++++++++++++++++++++

This markup:

---------------------------------------------------------------------
.Array
[latexmath]
++++++++++++++++++++++++++++++++++++++++++++
\begin{eqnarray*}
4r^2\int_0^{\pi/2} \cos^2 \theta\, d\theta
&=& 4r^2\int_0^{\pi/2} \frac{1}{2}(1 + \cos 2\theta) \,d\theta\\
& = & {2r^2\theta}\Bigg{|}_0^{\pi/2}
  + 2r^2\int_0^{\pi/2} \cos 2\theta \,d\theta\\
& = & \pi r^2 + 2r^2(\sin2\theta)\Bigg{|}_0^{\pi/2}\\
& = & \pi r^2
\end{eqnarray*}
++++++++++++++++++++++++++++++++++++++++++++
---------------------------------------------------------------------

Renders:

.Array
[latexmath]
++++++++++++++++++++++++++++++++++++++++++++
\begin{eqnarray*}
4r^2\int_0^{\pi/2} \cos^2 \theta\, d\theta
&=& 4r^2\int_0^{\pi/2} \frac{1}{2}(1 + \cos 2\theta) \,d\theta\\
& = & {2r^2\theta}\Bigg{|}_0^{\pi/2}
  + 2r^2\int_0^{\pi/2} \cos 2\theta \,d\theta\\
& = & \pi r^2 + 2r^2(\sin2\theta)\Bigg{|}_0^{\pi/2}\\
& = & \pi r^2
\end{eqnarray*}
++++++++++++++++++++++++++++++++++++++++++++

This markup:

---------------------------------------------------------------------
.List
[latexmath]
++++++++++++++++++++++++++++++++++++++++++++
\begin{enumerate}
\item $\frac{da}{dx} = 0$
\item $\frac{d}{dx} ax = a$
\item $\frac{d}{dx} x^n = nx^{n-1}$
\item $\displaystyle \frac{d}{dx} (f(x) + g(x))
  = \frac{d}{dx} f(x) + \frac{d}{dx} g(x)$
\item $\displaystyle \frac{d}{dx} f(x)g(x)
  = g(x) \frac{d}{dx} f(x) + f(x) \frac{d}{dx} g(x)$
\item $\displaystyle  \frac{d}{dx} \frac{f(x)}{g(x)}
  = \frac{g(x) \frac{d}{dx} f(x) - f(x) \frac{d}{dx} g(x)}{(g(x))^2}$
\end{enumerate}
++++++++++++++++++++++++++++++++++++++++++++
---------------------------------------------------------------------

Renders:

.List
[latexmath]
++++++++++++++++++++++++++++++++++++++++++++
\begin{enumerate}
\item $\frac{da}{dx} = 0$
\item $\frac{d}{dx} ax = a$
\item $\frac{d}{dx} x^n = nx^{n-1}$
\item $\displaystyle \frac{d}{dx} (f(x) + g(x))
  = \frac{d}{dx} f(x) + \frac{d}{dx} g(x)$
\item $\displaystyle \frac{d}{dx} f(x)g(x)
  = g(x) \frac{d}{dx} f(x) + f(x) \frac{d}{dx} g(x)$
\item $\displaystyle  \frac{d}{dx} \frac{f(x)}{g(x)}
  = \frac{g(x) \frac{d}{dx} f(x) - f(x) \frac{d}{dx} g(x)}{(g(x))^2}$
\end{enumerate}
++++++++++++++++++++++++++++++++++++++++++++

This markup:

---------------------------------------------------------------------
.Matrix
[latexmath]
++++++++++++++++++++++++++++++++++++++++++++
\[ P^{e \rightarrow c}= \left[
  \begin{array}{*{3}{r@{}l}}
  & \cos \theta & & \sin \theta \sin \varphi & & \sin \theta \cos \varphi\\

  & \sin \theta \sin \psi
  & & \cos \varphi \cos \psi - \cos \theta \sin \varphi \sin \psi
  & - & \sin \varphi \cos \psi - \cos \theta \cos \varphi \sin \psi\\

  - & \sin \theta \cos \psi
  & & \cos \varphi \sin \psi + \cos \theta \sin \varphi \cos \psi
  & - & \sin \varphi \sin \psi + \cos \theta \cos \varphi \cos \psi\\
  \end{array}
\right] \]
++++++++++++++++++++++++++++++++++++++++++++
---------------------------------------------------------------------

Renders:

.Matrix
[latexmath]
++++++++++++++++++++++++++++++++++++++++++++
\[ P^{e \rightarrow c}= \left[
  \begin{array}{*{3}{r@{}l}}
  & \cos \theta & & \sin \theta \sin \varphi & & \sin \theta \cos \varphi\\

  & \sin \theta \sin \psi
  & & \cos \varphi \cos \psi - \cos \theta \sin \varphi \sin \psi
  & - & \sin \varphi \cos \psi - \cos \theta \cos \varphi \sin \psi\\

  - & \sin \theta \cos \psi
  & & \cos \varphi \sin \psi + \cos \theta \sin \varphi \cos \psi
  & - & \sin \varphi \sin \psi + \cos \theta \cos \varphi \cos \psi\\
  \end{array}
\right] \]
++++++++++++++++++++++++++++++++++++++++++++
