3

Possible Duplicate:
When to use \LetLtxMacro?

I have a problem in redefining a command with an optional argument in terms of its old definition. Here is what I did:

\newcommand{\testopt}[2][optional]{opt:#1;  arg:#2.}  
\let\oldtestopt\testopt  
\renewcommand{\testopt}[2][newoptional]{\oldtestopt[0]{1}} 

I expect now \testopt{argument} to typeset opt:0; arg:1..
When I typeset the file the compiler freezes as it was in a loop. I tried a similar example without optional argument and it worked as expected.

Can anybody explain me where the error is?

Nicola
  • 123
  • 6
    Welcome to TeX.sx! Related: http://tex.stackexchange.com/questions/88001/when-to-use-letltxmacro The answer there explains the problem; see also http://tex.stackexchange.com/a/29837/4427 – egreg Jan 18 '13 at 12:07
  • Welcome to TeX.sx! This question is very similar to http://tex.stackexchange.com/questions/88001/when-to-use-letltxmacro. Please take a look at it as the information there might help you. If so, that's great, and we'll probably close this question as a duplicate just to keep the place tidy and to help people find answers quickly. If not, please edit your question here to explain why so that people can better focus their attention to help you. – Martin Schröder Jan 18 '13 at 12:42

0 Answers0