3

I want all my images to be the same size. Is there a nice way to impose this rule in the preamble?

\begin{figure}[htbp]
  \centering
    \includegraphics[width=6cm]{my_image}
  \caption{describe my image}
  \label{fig:my_image}
\end{figure}
5

By adding

\let\oldincludegraphics\includegraphics
\renewcommand{\includegraphics}[2][]{%
  \oldincludegraphics[<default settings>,#1]{#2}}

to your document preamble (after loading graphicx), you can set up default settings to be included for every figure.

For example, you can change <default settings> to be width=6cm, height=3cm (say) and all figures will have a width of 6cm and a height of 3cm, unless you specify other local options to override this. That is, the above redefinition still allows you to use \includegraphics[width=2cm]{<image>} which will set <image> to have width 2cm (and height 3cm).

The above method is similar to adding

\setkeys{Gin}{<default settings>}

to your preamble, which sets the default key-values for the Gin family (used for the inclusion of Graphics.

  • Thanks that's works great but for one thing. When I try to override it on my front page logo with \includegraphics[width=2cm]{<image>} this does not seem to work. Any ideas why that might be? – Magpie Jan 10 '15 at 20:15
  • 1
    @Magpie: I tried both approaches and they allow for local overriding. You must be doing something different... – Werner Jan 10 '15 at 21:10
  • Yes, I missed out the ,#1 bit somehow. Thanks for clarifying. – Magpie Jan 28 '15 at 13:18

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.