GeneralAccessing a previous LaTeX \def

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

Accessing a previous LaTeX \def

Post by JeffR »

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.)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

esdd
Posts: 36
Joined: Sat Jan 25, 2014 9:13 pm

Accessing a previous LaTeX \def

Post by esdd »

You can use \let or \edef to save the old definition in \linedL

Code: Select all

\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

Re: Accessing a previous LaTeX \def

Post by JeffR »

Thanks, that's great -- thanks very much Elke!
Post Reply