How to Make Beamer Objects Appear in Different Places
At a glance
- 1. Choose a method
Use ordinary overlay commands for layout flow, or TikZ when you need precise positions on the slide.
- 2. Select an overlay
Use \only with different overlay specifications to show the object at different stages.
- 3. Control the layout
Reserve space with an overlayarea or position nodes relative to the slide to prevent shifting.
- 4. Compile and check
Compile the presentation and inspect each overlay, since one Beamer frame produces multiple slides.
A Beamer frame can produce several slides, called overlays. You can show an object at one position on the first overlay and another position on the next by making its placement depend on the overlay number.
For ordinary text and content in the page layout, use Beamer overlay commands such as \only or \uncover. For precise placement anywhere on the slide, TikZ lets you position nodes relative to the page. The right choice depends on whether you want the rest of the content to reflow or stay put.
Use overlay commands for content in the page layout
Write separate versions of the content, each with an overlay specification:
\only<1>{Text at the first position}
\only<2>{Text at the second position}
The number selects the overlay on which the content appears. If the text is part of a paragraph or list, its position follows the document’s normal layout. The positions can differ because you put the content at different points in that layout.
Be aware that \only removes its content entirely on overlays where it is not selected. This can change the space available to surrounding material, making other text or objects jump. If you want the content to reserve its space while hidden, use \uncover or \visible instead. Both keep the content in the layout; \uncover applies Beamer’s covered-content appearance, while \visible hides it.
Keep an area stable with overlayarea
If alternatives have different heights, an overlayarea can reserve a fixed-size region for them. This helps keep content below the region from shifting between overlays:
\begin{overlayarea}{\textwidth}{3cm}
\only<1>{First version}
\only<2>{Second version, which may be taller}
\end{overlayarea}
The width and height are fixed for the region. Choose a height large enough for the tallest version. This is useful for replacing text, diagrams, or other content within a known part of the frame; it does not, by itself, place items at arbitrary coordinates.
Place an object precisely with TikZ
For an object that should move to specific slide positions, make a TikZ picture with the overlay option and put a separately positioned node on each overlay. The following complete example displays a box left of the slide center, then right of it:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{frame}[plain]
\begin{tikzpicture}[remember picture,overlay]
\only<1>{
\node[draw,fill=blue!15] at
([xshift=-2cm]current page.center) {Object on the left};
}
\only<2>{
\node[draw,fill=orange!20] at
([xshift=2cm]current page.center) {Object on the right};
}
\end{tikzpicture}
\end{frame}
\end{document}
The remember picture,overlay options allow the picture to use page coordinates without taking up ordinary layout space. current page.center refers to the center of the slide, and xshift moves the node left or right. The \only<1>{...} and \only<2>{...} wrappers choose which node is drawn on each overlay. The frame therefore produces two slides, each with the object in a different place.
For more elaborate layouts, use other page anchors, such as current page.north west, and shift from them. You can also position an object relative to a TikZ coordinate or a named node instead of the page. Avoid using absolute page positions for content that should move with a title or other layout element.
Common mistakes
- Expecting
\onlyto preserve space. It does not. If surrounding material shifts, use\uncover,\visible, or a fixed-heightoverlayareaas appropriate. - Confusing overlays with separate frames. Overlay 1 and overlay 2 are successive slides generated from the same
frameenvironment. - Using
\vspaceto fine-tune complex movement. Small spacing adjustments may work for simple content, but they are fragile when text or fonts change. For exact placement, use TikZ coordinates. - Forgetting what page coordinates measure. A page-relative node is positioned on the slide, not relative to the text block. Check its position with the actual theme and frame layout you plan to use.
- Assuming a fixed area can fit anything. An
overlayareamust be large enough for the tallest content, or the content may extend beyond it.
Which method should you use?
Use \only when alternatives belong in the normal reading flow and you are comfortable with the layout changing as they appear. Use \uncover or \visible when hidden content should keep its place. Use TikZ with page-relative coordinates when the main goal is to make an object appear at exact, different locations on successive overlays.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.