I have always wondered how certain macros are made and I usually use the \show command to get a glimps of its definition. Is it possible to print the definition of a macro with a command, say \printmacro{\quad}, which will in turn create a .pdf (or .txt) file with the definition and the location (the file) in which it is defined?
Update:
The following features would be great:
- Create the
\printmacrocommand with the option[printhere]. That is, it will emulate the behaviour of\meaning. - Create the options
printtopdforprinttotxtfile. - Note that all of these options should automatically indicate which file contains the definition of the command. If the exact location of the file which contains the command definition can be extracted, that would be great.

\meaning:\meaning\quad– cgnieder Nov 18 '13 at 20:12-¿“hskip 1em“relaxbut its close to it. – azetina Nov 18 '13 at 20:14\texttt{\meaning\quad}, or then\let\printmacro\textttwould also work. Providing file location would be difficult, period. – Werner Nov 18 '13 at 20:18\usepackage[T1]{fontenc}if you don't want to use teletype – cgnieder Nov 18 '13 at 20:22Location: some.sty file. If the exact location in my TeX distribution can be printed it would be perfect. – azetina Nov 18 '13 at 20:25(so just look in those (and in latex.ltx which is the source of the latex format) – David Carlisle Nov 18 '13 at 20:52latex.ltxand then in the loaded packages to run fewer searches and then test other packages somewhat like what TeX.SX does with the tags. – azetina Nov 18 '13 at 20:59latexdefcan do for you in command line console:xxx$ latexdef -s tabular% latex.ltx, line 5006:\def\tabular{\let\@halignto\@empty\@tabular}. But I usually dotexdoc source2eand use the search of my pdf viewer. – Nov 18 '13 at 21:01\printmacro\sectionwould probably disappoint you; and\printmacro\makeboxwill make you cry in dismay. Printing the definition of such macros is rather pointless, because you'd have to restart adding the definition of\@startsectiononly to discover the beauties of\@sect,\@ssect,\@xsect, … Looking for the definition inlatex.ltxduring a LaTeX run is next to impossible (unless you want to scan the file line by line). – egreg Nov 18 '13 at 22:23\meaningis only for display, you can't get the definition itself (as a sequence of TeX tokens). See also tex core - How to get number of arguments in a macro? - TeX - LaTeX Stack Exchange – user202729 Dec 10 '21 at 07:01