4

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?

6
\includegraphics[scale=\factor , scale= 0.8]{foo.pdf}
  • Thanks a bunch! That was quite a bit more elementary to solve than I anticipated. – Holtor Aug 11 '14 at 16:11
  • I would have thought [scale=0.8, scale=\factor]! – Yiannis Lazarides Aug 11 '14 at 16:21
  • @YiannisLazarides in an ideal world (not this one, admittedly) multiplication is commutative. – David Carlisle Aug 11 '14 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 '14 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 '14 at 21:00
0

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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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