I am looking for a command similar to show, but want the output in the document itself. All the examples I have found produce the output in the terminal, not the document.
So, I want to replace the use of \show
with an appropriate macro in the following:
\documentclass{article}
\newcommand*{\MyFrac}{\ensuremath{\frac{\pi}{4}}}
\begin{document}
The macro \textbackslash MyFrac is set to \show\MyFrac.
\end{document}
and the output I want produced is
The macro \MyFrac is set to \ensuremath{\frac{\pi}{4}}
I could probably use the verbatim package, but I think that would require me to change the definition at two places if it was to be updated. I want to be able to define the macro in one place and be able use it as needed, but also to be able to display the LaTeX code associated with it.