LaTeX forum ⇒ General ⇒ Accessing a previous LaTeX \def Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
JeffR
Posts: 9
Joined: Thu Aug 29, 2013 6:39 pm

Accessing a previous LaTeX \def

Hello, I am trying to sort out a minor but awkward LaTeX issue. The command \L is defined in LaTeX to be an L with a line through it. But I frequently need a caligraphic L, so my papers normally begin with "\def\L{{\cal L}". Unfortunately, I occasionally need to refer to a Polish author whose name begins with \L. So, I would like to still define \L to be {\cal L} since I am so used to that, but be able to somehow access the original \L definition on occasion. I suppose I could enclose all the rest of my paper in { } and thus limit the scope of my redefined \L, but I would rather not have to do that. What I want is something like:
\def\linedL{{\L}}
\def\L{{\cal L}}
and then access the two macros separately. But of course this doesn't work correctly, since the second definition automatically modifies the first definition too. Any suggestions of how to make this work the way I want? Thanks! (And, sorry if this is already covered somewhere -- I coudln't think of what keywords to search for.)

esdd
Posts: 36
Joined: Sat Jan 25, 2014 9:13 pm
You can use \let or \edef to save the old definition in \linedL

\documentclass{scrartcl}\usepackage{xspace}\edef\linedL{\L\noexpand\xspace}\def\L{\mathcal{L}} \begin{document}\linedL and $\L$\end{document}

Best regards
Elke

JeffR
Posts: 9
Joined: Thu Aug 29, 2013 6:39 pm
Thanks, that's great -- thanks very much Elke!