I would like to typeset an introduction to MathJAX/LaTeX formulae.
For that, I introduced a macro:
\newcommand{\showsource}[1]{$#1$ : \verb|#1|}
To typeset a math formula and then show its source.
But when I use it as
\showsource{\frac{1}{2}}
XeLaTeX complains about a missing $.
How can I write such a macro correctly?
Edit (MWE -- Manuel Kuehner)
\documentclass{article}
\newcommand{\showsourceA}[1]{$#1$}
\newcommand{\showsourceB}[1]{verb|#1|}
\begin{document}
\showsourceA{\frac{1}{2}}
\showsourceB{\frac{1}{2}}
\end{document}
\showsourceA
works and\showsourceB
(including theverb
) doesn't.