How can you safely use Perforce $Revision$ in LaTeX document?
I'd like to include Perforce's $Revision$
keyword in my LaTeX document. However, the presence of #
seems to mess thing up. For example, if you have something like this:
\cfoot{$Revision: #8 $}
you end up with an err开发者_如何转开发or like "Illegal parameter number in definition of \temp@a". I did some searching and found packages (such as the LaTeX rcs package) that handle other keywords (such as Date) but nothing that appeared to handle the #
.
\let \savecfoot \cfoot
\def \cfoot{\catcode`\#=12 \cfoothelp}
\def \cfoothelp #1{\savecfoot{#1}\catcode`\#=6 }
New:
To turn off the meaning of $ too:
\let \savecfoot \cfoot
\def \cfoot{\catcode`\#=12 \catcode`\$=9 \cfoothelp}
\def \cfoothelp #1{\savecfoot{#1}\catcode`\#=6 \catcode`\$=3 }
精彩评论