Re: complex renewcommand \cite
On 2012-11-24 18:20:45 +, 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. If i do not put % latex loops forever. Any idea what i made wrong? Two sample tex file are attached. The Test_orig.tex still compiles but does not have the preamble changes. Andreas test.tex Description: Binary data Test_orig.tex Description: Binary data
Re: complex renewcommand \cite
On 11/25/2012 04:32 PM, Andreas Paeffgen wrote: On 2012-11-24 18:20:45 +, 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
Re: complex renewcommand \cite
On 2012-11-24 18:20:45 +, 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. If i do not put % latex loops forever. Any idea what i made wrong? Two sample tex file are attached. The Test_orig.tex still compiles but does not have the preamble changes. Andreas test.tex Description: Binary data Test_orig.tex Description: Binary data
Re: complex renewcommand \cite
On 11/25/2012 04:32 PM, Andreas Paeffgen wrote: On 2012-11-24 18:20:45 +, 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
Re: complex renewcommand \cite
On 2012-11-24 18:20:45 +, 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. If i do not put % latex loops forever. Any idea what i made wrong? Two sample tex file are attached. The Test_orig.tex still compiles but does not have the preamble changes. Andreas test.tex Description: Binary data Test_orig.tex Description: Binary data
Re: complex renewcommand \cite
On 11/25/2012 04:32 PM, Andreas Paeffgen wrote: On 2012-11-24 18:20:45 +, 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
Re: complex renewcommand \cite
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
Re: complex renewcommand \cite
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
Re: complex renewcommand \cite
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
complex renewcommand \cite
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. If i use the expandet command in an ERT, it works. See the attached test.lyx test.lyx Description: Binary data Any suggestions what i do wrong? I need only one variable. the last {} should be empty all the time. \texorpdfstring{\cite{Gilbert}}{} This is the text in ERT and this works. Andreas
complex renewcommand \cite
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. If i use the expandet command in an ERT, it works. See the attached test.lyx test.lyx Description: Binary data Any suggestions what i do wrong? I need only one variable. the last {} should be empty all the time. \texorpdfstring{\cite{Gilbert}}{} This is the text in ERT and this works. Andreas
complex renewcommand \cite
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. If i use the expandet command in an ERT, it works. See the attached test.lyx test.lyx Description: Binary data Any suggestions what i do wrong? I need only one variable. the last {} should be empty all the time. \texorpdfstring{\cite{Gilbert}}{} This is the text in ERT and this works. Andreas