I want to save \fboxsep
length in \oldfboxsep
and use it later. The following code doesn't work:
\newlength{\oldfboxsep}
\let\oldfboxsep\fboxsep % 3pt by default
\setlength{\fboxsep}{8pt}
\fbox{\begin{minipage}{.9\textwidth}
\setlength{\fboxsep}{\oldfboxsep}
Text\fbox{Box}Text
\end{minipage}}
While the following code works:
\newlength{\oldfboxsep}
\setlength{\oldfboxsep}{\fboxsep} % 3pt by default
\setlength{\fboxsep}{8pt}
\fbox{\begin{minipage}{.9\textwidth}
\setlength{\fboxsep}{\oldfboxsep}
Text\fbox{Box}Text
\end{minipage}}
What are the differences between these two ways?
Best Answer
When you
\let
a length/dimension to another, the newly let length points to the same register. In similar respects one might think of this\let
ting as making a pointer (in programming language) to an existing data structure. For example, consider the following MWE:To be more specific, the
\show
commands add the following to the.log
:Of course, the proper way is to define a new length and setting the one length to the other, as you did in your second example.
Perhaps, in a very likewise manner (from the TeX Book):