I have the following code for an equation using TikZ pictures.
\documentclass[crop,tikz,convert={outext=.svg,command=\unexpanded{pdf2svg \infile\space\outfile}},multi=false]{standalone}[2012/04/13]
\usepackage{amsmath}
\def\Hask{\mathsf{Hask}}
\def\Id{\mathsf{Id}}
\def\T{\mathsf{T}}
\begin{document}
\begin{equation*}
\begin{tikzpicture}[node distance=2cm, auto]
\node (H1) {$\Hask$};
\node (H2) [right of= H1] {$\Hask$};
\draw[->, bend left] (H1) to node[above] {$\Id_{\Hask}$} (H2);
\draw[->, bend right] (H1) to node[below] {$\T$} (H2);
\end{tikzpicture} =
\begin{tikzpicture}[node distance=2cm, auto]
\node (H1) {$\Hask$};
\node (H2) [right of= H1] {$\Hask$};
\draw[->, bend left] (H1) to node[above] {$\Id_{\Hask}$} (H2);
\draw[->, bend right] (H1) to node[below] {$\T$} (H2);
\end{tikzpicture}
\end{equation*}
\end{document}
I.e., note the use of in-line math in the text nodes. Unfortunately it does not work, and yields the following errors:
(/usr/local/share/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
! Missing $ inserted.
<inserted text>
$
l.28 \end{tikzpicture}
=
?
! Missing \endgroup inserted.
<inserted text>
\endgroup
l.28 \end{tikzpicture}
=
?
! Display math should end with $$.
<to be read again>
\par
l.28 \end{tikzpicture}
=
?
[1]
! LaTeX Error: \begin{equation*} on input line 22 ended by \end{tikzpicture}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.28 \end{tikzpicture}
=
?
Overfull \hbox (22.7778pt too wide) in paragraph at lines 28--34
[]\OT1/cmr/m/n/10 =
Overfull \vbox (3.66875pt too high) has occurred while \output is active
[2{/usr/local/share/texmf-var/fonts/map/pdftex/updmap/pdftex.map
}] [3]
! LaTeX Error: Bad math environment delimiter.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.35 \end{equation*}
?
! LaTeX Error: \begin{document} ended by \end{equation*}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.35 \end{equation*}
?
! Missing $ inserted.
<inserted text>
$
l.35 \end{equation*}
?
! Display math should end with $$.
<to be read again>
\endgroup
l.35 \end{equation*}
?
! Extra \endgroup.
<recently read> \endgroup
l.35 \end{equation*}
?
[4] (./monadUnit.aux) )</usr/local/share/texmf-dist/fonts/type1/public/amsfonts
/cm/cmr10.pfb></usr/local/share/texmf-dist/fonts/type1/public/amsfonts/cm/cmss1
0.pfb></usr/local/share/texmf-dist/fonts/type1/public/amsfonts/cm/cmss8.pfb>
Output written on monadUnit.pdf (4 pages, 24416 bytes).
Transcript written on monadUnit.log.
system returned with code 256
Class standalone:
Output written on monadUnit.svg.
) )
No pages of output.
Transcript written on monadUnit.log.
So what is the trick to make this work?
A related question was asked here before TikZ Diagrams in Math Mode but for the math mode text in the nodes.
Addendum
The solution provided by @gernot works for me, provided we define multi={equation*}
in the document class declaration. This is needed to get correctly cropped output.
standalone
processingbaseline=(H1.base)
to the two tikzpictures, to align the pictures with the equality signstandalone
?