Created
July 15, 2015 15:52
-
-
Save kbauer/d8bad4d44603465ffd5d to your computer and use it in GitHub Desktop.
For debugging/learning LaTeX internals it is useful to dump the definition of commands. Reading the output of `\show` from the console however is inconvenient. The command `\meaning` is useful here (as it prints the definition to the document) but limited. `\mymeaning` is a wrapper, where you specifiy the name of a macro rather than the `\macro`…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% \mymeaning{command} -> Definition of \command | |
\makeatletter | |
\newcommand{\mymeaning}[1]{ | |
\begingroup% | |
\setlength{\parindent}{0em} | |
\setlength{\hangindent}{1em} | |
\edef\@tmp{\ifmmode\noexpand\mathtt\else\noexpand\texttt\fi} | |
\@tmp{% | |
\expandafter\string\csname #1\endcsname->% | |
\expandafter\meaning\csname #1\endcsname;% | |
}% | |
\@ifundefined{#1\space}{}{ | |
\par | |
\mymeaning{#1\space} | |
} | |
\endgroup% | |
\par% | |
} | |
\makeatother |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment