[texhax] the \let command
Uwe Lück
uwe.lueck at web.de
Wed Nov 29 02:56:14 CET 2006
... and here, \let me invite you to \relax with a few tricks that work indeed.
I hope that I can help you another time, before my boss strikes off my head.
At 14:01 27.11.06, R.Tange at soton.ac.uk wrote:
>\let\tie\t
>\renewcommand{\t}{t}
>\let\mycedilla\c
>\renewcommand{\c}{c}
>
>\begin{document}
>
>\noindent\t bb\\
>\tie bb\\
>\c b\\
>\mycedilla b\\
>
>\end{document}
>
>As you can see \tie does not produce the tie under the b's, so it does not
>point to the original definition of \t (once again: I would like something
>that points to the original def of \t and keeps doing so when I redefine
>\t).
First solution (change \meaning locally in a group):
\c b {\renewcommand{\c}{\textit{c}}\c b} \c b
\t bb {\renewcommand{\t}{\textit{t}}\t bb} \t bb
Next: first, version b (advanced: more LaTeX-like):
\newenvironment{c t changed}
{\renewcommand{\c}{\textit{c}}%
\renewcommand{\t}{\textit{t}}}
{}
\c b \t bb
\begin{c t changed}
\c b \t bb
\end{c t changed}
\c b \t bb
-- I won't be surprised if you find these previous solutions
little useful for the applications you have in mind ...
so \let me try again -- the other way round, switch
to the original definitions locally:
\let\ced\c
\let\tie\t
\renewcommand{\c}{\textit{c}}
\renewcommand{\t}{\textit{t}}
\newcommand{\cedindeed} [1]{{\let\c\ced \c#1}}
\newcommand{\tiedindeed}[1]{{\let\t\tie \t#1}}
%% <- You see that \c and \t must get back their original meanings.
%% It doesn't suffice to call them by names storing their meanings.
\begin{document}
\c bb \cedindeed {bb} \c bb
\t bb \tiedindeed{bb} \t bb
\end{document}
More information about the texhax
mailing list