Setting width or height for graphics in beamer only works with .png?

Viet picture Viet · May 9, 2015 · Viewed 7.3k times · Source

This is a problem I had with TexLive 2013 and 2014; working on Mac OS X, 10.8. I have to use xelatex or lualatex because of East Asian fonts.

When using picture files with \includegraphics[settings-for-scaling]{filename}, I can only use .png files reasonably, JPEGs are always shown in their original size.

I tried this with a minimum beamer document, graphicx package loaded.

Also, I tried several ways to scale (cm, textwidth, etc.). Here are some examples:

Replaced [settings-for-scaling] in \includegraphics[settings-for-scaling]{filename} with any of the following options:

  • [height=6cm], [height=0.8\textheight]
  • [width=6cm], [width=0.9\textwidth],
  • [height=6cm, width=6cm], [height=0.8\textheight, width=0.9\textwidth]
  • [keepaspectratio, height=0.8\textheight, width=0.9\textwidth]

The last solution being preferred for beamer presentations.

I thought it might be a flaw in my settings, but it does not work with the default settings, TexLive installation seems to be OK.

Answer