General ⇒ variable in preamble
variable in preamble
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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
variable in preamble
Code: Select all
\newcommand*{\factor}{0.75}
Code: Select all
\includegraphics[scale=\factor]{filename}
Best regards and welcome to the board
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: variable in preamble
- 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?
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
variable in preamble
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