# A Mathjax 'cheatsheet' in LaTeX [duplicate]

I would like to write a LaTeX document in which several Mathjax commands are shown as source code and compiled.

So I want to have a list of items and have them show up on, for example, the left side as source code for Mathjax e.g. a^2 and on the right side have it show what it will look like e.g. a², but I do not want to enter the code twice for maintenance reasons.


\usepackage{showexpl}
\begin{document}
\begin{LTXexample}
$\geq$
\end{LTXexample}
\end{document}


The result of this (for my document) was pretty much the same as in the above case.

I tried

• Hi! Welcome to the site :) As it stands this question is quite hard to answer. The model we follow here is Question and Answer and it generally works best if you come to us with specific problems and a complete Minimal Working Example that demonstrates what you've done and reproduces the problems you are having. – Au101 Feb 10 '16 at 23:33
• Store your example code via filecontents package and use it via \lstinputlisting (from listings package) to show the code or via \input to show the result. – Paul Gaborit Feb 11 '16 at 0:49
• @Au101 Hi, thanks for the help. I wanted to include a minimal example, but I struggled with it because there could be several ways this might work and I really don't care whether I use a command or an environment or something that I just don't know yet. I will now try to include the code I already tried and hope that will clear it up. – anonymous Feb 11 '16 at 8:58
• @PaulGaborit I've seen that suggested before, but I could not figure out how to execute math environment commands with \input without having the $symbols show up in the listing. – anonymous Feb 11 '16 at 8:59 • @Fran I looked at the answers in hat thread, but with those solutions I had the same problems as with the ones I described in my edit above. – anonymous Feb 11 '16 at 9:28 ## 1 Answer I found what I needed in Print small TeX code verbatim and render it. I used: \newcommand\showcase[1]{{\ttfamily\detokenize{#1}} &$#1\$ }

\begin{document}
\begin{tabular}{c|c}
\showcase{\geq}
\end{tabular}
\end{document}