[texhax] Problem with \let

Morten Høgholm morten.hoegholm at gmail.com
Wed Aug 22 08:44:04 CEST 2007


On Wed, 22 Aug 2007 04:00:44 +0200, Michael Barr wrote:

> Here is a problem that has me stymied.  Consider the file:
>
> \documentclass{article}
> \usepackage{test}
>
> \begin{document}
> \cite{slo}
> \begin{thebibliography}{}
> \bibitem [S\pol omi\'nski (1959)]{slo} J. S\pol omi\'nski (1959), {\bf
> The theory of abstract algebras with infinitary operations}.  Rozprawy
> Mat. {\bf18}, Warszawa.
> \end{thebibliography}
> \end{document}
>
> The contents of test.sty are:
>
> \let\pol\l
>  % \renewcommand{\l}{\mathop{\ell}}
>
> Everything works well.  Now take out the comment mark and it blows up.
> Using \def instead of \renewcommand makes no difference.  It is only in
> the \cite macro that the problem arises; take that out and the reference
> is set correctly.  I believed that \let sets it argument in stone; that
> no further redefinition of \l would have any effect on \pol, but this is
> apparently not the case.  Any help would be appreciated.  I can and will
> fill in the citation by hand, if necessary, but I would like to know
> what is going on.

\l is defined with \DeclareTextCommand which leads to the following  
firstlevel expansion:
   \l ->\OT1-cmd \l \OT1\l

The \l contained therein is used when writing to files to ensure  
robustness, so when you do \let\pol\l it still writes \l to the aux file,  
where references are stored.

You need to use the interface provided by LaTeX for this and use the  
definition from ot1enc.def only exchanging \pol for \l:
   \DeclareTextCommand{\pol}{OT1}{\hmode at bgroup\@xxxii l\egroup}

-- 
Morten


More information about the texhax mailing list