例如,我定义了两个命令。\mytesta
带有可选参数,\mytestb
不带有可选参数。现在使用\cs_meaning:N
显示命令定义。结果如下:
\documentclass{article}
\newcommand{\mytesta}[2][]{#2\quad#1}
\newcommand{\mytestb}[2]{#1\quad#2}
\setlength{\parindent}{0pt}
\ExplSyntaxOn
\cs_set_eq:NN \checkmeaning \cs_meaning:N
\ExplSyntaxOff
\begin{document}
\Large
\section{Testing}
\par\mytesta[default]{argument}
\par\mytestb{argument}{default}
\vskip 2em
\par\verb|\mytesta:|
{\par\ttfamily\checkmeaning \mytesta}
\par\verb|\mytestb:|
{\par\ttfamily\checkmeaning \mytestb}
\vskip 2em
\par\verb|Is possible to show:|
\par\verb|"[#1]#2->#2\quad #1" in \mytesta?|
\end{document}