4

I would like to redefine \cite{} so that text like

\cite{blah:1991:pldi}

gets replaced by

\cite{blah:1991:pldi:short}

I tried the following:

\let\oldcite\cite
\renewcommand{\cite}[1]{\oldcite}{#1:short}}

However, this does not work with multiple arguments to \cite{}.

For instance, I would like

\cite{blah1, blah2}  

to be replaced by

\cite{blah1:short, blah2:short}

as well.

Any suggestions?

  • 2
    Hi Prakash, welcome to TeX.sx! I've formatted your code snippets, which you can also do yourself by selecting them and pressing the {} button (or pressing Ctrl+k. I've also removed the "Thanks" at the end of the question, which is common practice on this site. – Jake Oct 25 '11 at 1:15
8

Assuming that you do not use packages that redefine \cite (like cite.sty), try this:

\makeatletter
\def\@citex[#1]#2{\leavevmode
  \let\@citea\@empty
  \@cite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{,\penalty\@m\ }%
     \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
     \if@filesw\immediate\write\@auxout{\string\citation{\@citeb:short}}\fi
     \@ifundefined{b@\@citeb}{\hbox{\reset@font\bfseries ?}%
       \G@refundefinedtrue
       \@latex@warning
         {Citation `\@citeb' on page \thepage \space undefined}}%
       {\@cite@ofmt{\csname b@\@citeb\endcsname}}}}{#1}}
\makeatother
  • @Prakash: If you find the answer helpful, you should upvote it. If you feel your question is answered, you can and should mark it as such by clicking the tick mark next to the answer. – Jake Oct 25 '11 at 2:57
  • @Jake: Sure. Just did. – Prakash Oct 25 '11 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.