Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
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
add comment

1 Answer

up vote 8 down vote accepted

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
share|improve this answer
    
that works! thanks, Boris :) –  Prakash Oct 25 '11 at 2:42
    
@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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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