根据这个问题:
Redefining Commands in a New Environment
如何重新定义(或使用\def定义)使用参数的宏?我一直收到一个illegal parameter definition in \foo错误。因为我需要自定义分隔符,所以不能使用\newcommand或\renewcommand。
我的代码的一般形式如下所示:
\newenvironment{foo}{%
...spacing stuff and counter defs...
\def\fooitem#1. #2\endfooitem{%
...stuff...
}
\def\endfooitem{endfoo}
}
{...after material (spacing)...}这必须是可能的。现在我使用的是纯文本定义(正如我在上面的问题中提到的),但我真的希望与LaTeX系统保持一致。
发布于 2009-01-30 04:58:04
对于每个嵌套定义,您需要将#字符增加一倍。在内部,\newcommand或\newenvironment调用\def。
\newenvironment{foo}{%
...
\def\fooitem##1. ##2\endfooitem{%
...除此之外,这也是您要做的事情;没有纯LaTeX方法可以用来定义带有分隔参数的宏。
https://stackoverflow.com/questions/494432
复制相似问题