On 11/25/2012 04:32 PM, Andreas Paeffgen wrote:
On 2012-11-24 18:20:45 +0000, Richard Heck said:

On 11/23/2012 09:59 AM, Andreas Paeffgen wrote:
I want to get a different \cite command in the document. If i put \renewcommand{\cite}{\texorpdfstring{\cite{%}}{} } in the preamble i get an emergency stop.

This causes an infinite loop. \cite gets unpacked into something involving \cite, which gets unpacked into something else involving \cite, etc. Not so good. The problem is that LaTeX does not expand \cite when you give this command, but only when \cite itself is expanded. That is: \cite, even though it is a command, works like a variable. Consider:
     \newcommand\mystuff{a}
     \newcommand\inparens{(\mystuff)}
     \inparens
     \renewcommand\mystuff{b}
     \inparens
This will print "(a)" then "(b)". This is actually quite useful sometimes, and could equally well be done with more complicated commands. (This kind of thing is done in the LaTeX core all the time.)

The standard way around this kind of thing is:
     \let\oldcite=\cite
and then you redefine \cite in terms of \oldcite. The point is that \let actually assigns the *expanded* form (at that point) of \cite to \oldcite, rather than making \oldcite an alias for \cite (which would just give us the other problem back again). So, e.g.:
     \let\stuff=\mystuff
     \renewcommand\mystuff{c}
     \stuff
will still print "b", not "c".

Richard

I am not sure if i adapted your idea correctly. If i set in the preamble the following code

\newcommand\newcite{\texorpdfstring{\cite%}{}}
 \let\cite=\newcite

Latex stops with the following error:
Runaway argument?
{\texorpdfstring {\cite \let \cite =\newcite \par \renewcommand {\bibsection \E
TC.

Other way around:
    \let\oldcite=\cite
    \renewcommand\cite{\texorpdfstring{\oldcite...whatever...

rh

Reply via email to