Generalvariable in preamble

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
genome
Posts: 2
Joined: Wed Apr 22, 2009 7:47 pm

variable in preamble

Post by genome »

Hi all,

noob here with noobish question. If I have many graphics in my document and I want to resize them all at the same time, can I make a variable in the pre-amble and then use this variable in the scale of each \includegraphics command I use?

I'm sure there is a way to do this but so far I have not found any helpful stuff.

Cheers,
G

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

variable in preamble

Post by localghost »

You can declare a scaling factor in the preamble that only contains a numeric value.

Code: Select all

\newcommand*{\factor}{0.75}
Later on you can use the factor for scaling your included graphics.

Code: Select all

\includegraphics[scale=\factor]{filename}
This would scale your graphics to 75% of their original size.


Best regards and welcome to the board
Thorsten¹
genome
Posts: 2
Joined: Wed Apr 22, 2009 7:47 pm

Re: variable in preamble

Post by genome »

This is perfect thanks! Just wondering why you use a "*" after \newcommand?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

variable in preamble

Post by localghost »

genome wrote:[...] Just wondering why you use a "*" after \newcommand?
It slightly differs from the other version. Consider it as a "short" form.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

variable in preamble

Post by Stefan Kottwitz »

Hi genome,
genome wrote:Just wondering why you use a "*" after \newcommand?
you will find some additional information here in an introduction by Nicola L. C. Talbot: 2.8 Short and Long Commands.

Stefan
LaTeX.org admin
Post Reply