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
General ⇒ variable in preamble
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
You can declare a scaling factor in the preamble that only contains a numeric value.
Later on you can use the factor for scaling your included graphics.
This would scale your graphics to 75% of their original size.
Best regards and welcome to the board
Thorsten¹
Code: Select all
\newcommand*{\factor}{0.75}
Code: Select all
\includegraphics[scale=\factor]{filename}
Best regards and welcome to the board
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: variable in preamble
This is perfect thanks! Just wondering why you use a "*" after \newcommand?
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
variable in preamble
It slightly differs from the other version. Consider it as a "short" form.genome wrote:[...] Just wondering why you use a "*" after \newcommand?
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
- Stefan Kottwitz
- Site Admin
- Posts: 10348
- Joined: Mon Mar 10, 2008 9:44 pm
variable in preamble
Hi genome,
Stefan
you will find some additional information here in an introduction by Nicola L. C. Talbot: 2.8 Short and Long Commands.genome wrote:Just wondering why you use a "*" after \newcommand?
Stefan
LaTeX.org admin