简体   繁体   中英

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). But at times, I'd like to have Smith (2000) instead. 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命令,没有理由自己重新定义宏。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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