GeneralPreserving original values fpr parameters

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
johnsap
Posts: 9
Joined: Sat Dec 20, 2008 3:09 am

Preserving original values fpr parameters

Post by johnsap »

Gents,

I would like to know how to set parameters back to thier original values (not nesecerally default, but defined ealier in the document).

E.g. I changed the distance \doublerulesep via \setlength, but other parts of the document should maintain orininal value of this parameter (defined somewhere ealier and i do not know these original values).
So I need to set the parameter back to its originally defined value.

So I am looking to do somethinhg like that:

1. oldValue = getValue(\doublerulesep)
2. % draw table
3. \setlength\doublerulesep{oldValue}

Please advise !

Thanks a lot !

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Preserving original values fpr parameters

Post by phi »

LaTeX length assignments are local, so introduce a group to have them restored automatically:

Code: Select all

\documentclass{article}

\begin{document}

\begingroup
\setlength\doublerulesep{6pt}
\begin{tabular}{l||l}
a & a
\end{tabular}
\endgroup

\begin{tabular}{l||l}
a & a
\end{tabular}

\end{document}
Note that nearly every environment introduces such a group, so if you put the \setlength command and your tabular environment in another environment (perhaps a table environment), you don't need the extra \begingroup ... \endgroup.
Post Reply