Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In a LaTeX document I have about 70 images which are scaled using the graphicx-package and \includegraphics[scale=0.8]{foo.pdf}

where the scaling factor varies. Now I would like to rescale them all with a common factor, like

\newcommand*{\factor}{0.75}
\includegraphics[scale=\factor * 0.8]{foo.pdf}

except that is no LaTeX syntax. Can anyone provide a smart solution?

share|improve this question

2 Answers 2

\includegraphics[scale=\factor , scale= 0.8]{foo.pdf}
share|improve this answer
    
Thanks a bunch! That was quite a bit more elementary to solve than I anticipated. –  Holtor Aug 11 at 16:11
    
I would have thought [scale=0.8, scale=\factor]! –  Yiannis Lazarides Aug 11 at 16:21
    
@YiannisLazarides in an ideal world (not this one, admittedly) multiplication is commutative. –  David Carlisle Aug 11 at 16:39
1  
I wonder if you could explain this a bit: it seems entirely non-intuitive to me (keys normally override each other, so I'd expect the scale here to be 0.8 not 0.8 times \factor). –  Joseph Wright Aug 11 at 16:48
    
@JosephWright includegraphics keys don't overight they are cumulative and read left to right, mainly so that [height=1cm,angle=90] makes something 1cm wide but [angle=90,height=1cm] makes something 1cm high the fact that you can use two scale is an artifact of the implementation (and not something I've done before this answer I suspect:-) –  David Carlisle Aug 11 at 21:00

Another solution with fp package.

\documentclass{article}
\usepackage[nomessages]{fp}
\usepackage{graphicx}

\FPset\Factor{0.75}
\FPeval\Scale{round(Factor*0.8:2)}

\begin{document}
\includegraphics[scale=\Scale]{example-image-a}
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.