This command come from the question Equivalent of \show to display the LaTeX code in the document, the standard \meaning correctly says a command is undefined,
\documentclass{article}
\makeatletter
\newcommand\meaningbody[1]{%
{\ttfamily
\expandafter\strip@prefix\meaning#1}%
}
\makeatother
\begin{document}
\meaningbody\sectio
\end{document}
But that \meaningbody throw the errors when the command is undefined:
! Argument of \strip@prefix has an extra }.
<inserted text>
\par
l.12 \meaningbody\sectio
Then I tried this to fix:
\documentclass{article}
\makeatletter
\newcommand{\meaningbody}[1]
{%
{\ttfamily
\ifdefined#1
\expandafter\strip@prefix\meaning#1
\else
Command #1 undefined.
\fi}%
}
\makeatother
\begin{document}
\meaningbody\sectio
\end{document}
But still do errors:
! Undefined control sequence.
<argument> \sectio
l.17 \meaningbody\sectio

\meaningbody\box? – egreg Sep 05 '17 at 22:50