简体   繁体   English

LaTeX:暂时重新定义引文宏

[英]LaTeX: Redefining the citation macro temporarily

I'm new to latex, but it seems you can temporarily redefine some commands? 我是乳胶新手,但似乎你可以暂时重新定义一些命令? The problem I have is that normally the citation is (SMITH, 2000). 我遇到的问题是通常引用的是(SMITH,2000)。 But at times, I'd like to have Smith (2000) instead. 但有时候,我想让史密斯(2000)代替。 Anyway I can temporarily redefine it, then use the standard version again after that "block" of code? 无论如何我可以暂时重新定义它,然后在代码“块”之后再次使用标准版本?

Enclose the local definition in braces ({}). 将本地定义括在大括号({})中。

\newcommand\foo{FOO!}
\foo
{\renewcommand\foo{BAR?}\foo\foo}
\foo

This will generate something like: 这将产生类似于:

FOO!BAR?BAR? FOO!

This can be done inside macro definitions, too - just make sure you add the extra braces: 这也可以在宏定义中完成 - 只需确保添加额外的大括号:

\newcommand\newfoo{{\renewcommand\foo{BAR?}\foo}}

Hope this helps. 希望这可以帮助。

您应该已经拥有了应该执行\\citet操作的\\citep\\citet命令,没有理由自己重新定义宏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM