GeneralHow do I save values temporarily?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Julian_S_Moore
Posts: 72
Joined: Sun Nov 16, 2008 1:26 pm

How do I save values temporarily?

Post by Julian_S_Moore »

I need to switch fontsize and skip in a new command and want to be able to restore the values before the command was called (so I don't have to worry about knowing what they are all the time).

How would I do that?

Thanks

Recommended reading 2024:

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

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

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How do I save values temporarily?

Post by gmedina »

Hi,

you can use the grouping mechanism to keep changes local. The following code illustrates this (the font change produced by \myfontb will apply only to its argument):

Code: Select all

\documentclass{book}

\newcommand\myfonta[1]{\fontsize{20}{24}\selectfont#1}
\newcommand\myfontb[1]{{\fontsize{20}{24}\selectfont#1}}

\begin{document}

text text \myfonta{text text} text text
\normalsize

text text \myfontb{text text} text text

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Julian_S_Moore
Posts: 72
Joined: Sun Nov 16, 2008 1:26 pm

Re: How do I save values temporarily?

Post by Julian_S_Moore »

Ah! Thanks for the insight/reminder into grouping!
Post Reply