[texhax] Positioning figures in Latex/Beamer

Steve Schwartz s.schwartz at imperial.ac.uk
Sun Apr 2 12:44:27 CEST 2006


Here's a long answer to a short question (mostly because I'm off to a
conference tomorrow and hence have just revisited some of this). Jump to
the sample document below and revisit the details when you feel so

On Fri, 2006-03-31 at 22:26 -0500, Karthik Narayanaswamy wrote:
> I'm relatively new to the Tex world, and have so far been very pleased with 
> the platform. I finally decided to take the jump to give my next talk in PDF 
> format, and downloaded the Beamer class for this purpose. However, I 
> stumbled on a problem I'm unsure of how to solve - how do you position a 
> PNG/JPEG figure on a slide? I tried hard to search online, but I couldn't 
> find an option for \includegraphics or any other command to do the job.

Beamer typesets a page just like any other latex file, which means it
typesets first and then adjusts to the page after, so it doesn't
completely have an idea of what a page is. Beamer has more awareness
than some latex packages as to the vertical page layout, but you can't
easily see it. The consequence is that the placement of your figure can
only be relative to some text or other construct, NOT the page itself. I
use beamer's columns environment to split the page, and tend to put all
my figures in a column. Furthermore, I put them in an overprint
environment so I can do some animation ("overlays") without jittering
the text in the other column as beamer tries otherwise to balance the
columns. I've also found that using "\uncover<n->" for the text column
rather than standard overlay specification removes all the jitter.

For more control of the figure placement (which I suspect is your real
question) use the picture environment. \put will put anything (including
a graphic) anywhere you like, though it's position is specified relative
to the corner of the picture you declare. Here's an example to get you
going, with a small png figure attached. The rest is a bit of trial and
error. I often use the overpic package, which provides an easy way (with
the grid option) to place annotations, labels, lines, etc. on top of a
figure) but that doesn't solve your original question of placing the
figure on the page.


PS: There is what appears to me to be a bug in the overprint environment
in that the \onslide<...> command cannot be followed by anything that
begins a group (like a "{" or \begin{overpic}...). For example:


will displace Text2 vertically relative to Text (not as advertised by
overprint). Removing the curly braces works ok. But some things you want
to do implicitly open a new group. The workaround is to follow it by an
\mbox command, inside which you can do what you like, e.g.,


will write "else" on slide 4 where "anything" was on slide 3 as



\setlength{\unitlength}{\textwidth}  % measure in textwidths

\framebox{      % just so you can see where the "picture" is

Some text to follow.


Professor Steven J Schwartz      Phone: +44-(0)20-7594-7660
Space and Atmospheric Physics    Fax:   +44-(0)20-7594-7772
The Blackett Laboratory          E-mail: s.schwartz at imperial.ac.uk
Imperial College London          Office: Huxley 6M70 
London SW7 2BW, U.K.             Web: http://www.sp.ph.ic.ac.uk/~sjs

-------------- next part --------------
A non-text attachment was scrubbed...
Name: png.png
Type: image/png
Size: 825 bytes
Desc: not available
Url : http://tug.org/pipermail/texhax/attachments/20060402/46e1a01f/png.png

More information about the texhax mailing list