2

There are many similar questions to this here already (e.g., How can I make textpos respect beamer overlays? and beamer: how to use \pause with textblock* environment, and lots of questions on absolute positioning more generally), so let me try to clarify what I'm looking for, more specifically:

  1. I'd like to to place content at an absolute position, and this content may contain tikzpictures, etc., so I would rather not place it in a TikZ node (to avoid having nested TikZ pictures – and, for that matter, to avoid an extra compilation round). I may use coffins, etc., to do much of the placement, but I need some absolute starting-point (which I guess coffins don't supply?)

  2. I would like to be able to use beamer overlay commands like \pause, etc., without restrictions. In particular, I would like to avoid the need for wrapping their arguments in braces (which does solve the problem in some scenarios) – partly because I'll be using pseudo.sty, which has rather straightforward support for inserting \pause commands between lines. (Similar things hold for itemize and enumerate, with <+->.)

  3. I would rather not require transparent frame backgrounds.

I don't think any of the previous answers address these two requirements (though if there is a solution here already, that would be great – if so, sorry for the noise).

The obvious solution is to use textpos, but as has been pointed out previously (e.g., in the two questions referenced above), it doesn't play nice with \pause and the like.

A simple MWE illustrates the problem:

\documentclass{beamer}
\usepackage[absolute,overlay]{textpos}

\begin{document}
\begin{frame}
\begin{textblock*}{0pt}(0pt,0pt)
A\pause B\pause C
\end{textblock*}
\end{frame}
\end{document}

This will give you three slides; the first says "BC", the second says "C" and the last says "ABC".

The problem is with the overlay option. If this is removed, and we use a transparent background, things work, so this is technically a solution, but as mentioned, I would rather not require this in my solution.

\documentclass{beamer}

\usepackage[absolute]{textpos}
\setbeamercolor{background canvas}{bg=}

\begin{document}
\begin{frame}
\begin{textblock*}{0pt}(0pt,0pt)
A\pause B\pause C
\onslide<1->
\end{textblock*}
\end{frame}

\end{document}

(Here I've also added \onslide<1-> so the rest of whatever is on the page, such as page numbers or whatever, isn't paused.)

This is almost what I want, except I would like the option of having (or letting others have) colored backgrounds. (I could of course draw those myself, from within the absolutely positioned box, but…)

So … any ideas of emulating or fixing the overlay option, or some other way of handling the issue of transparent backgrounds – or perhaps even some entirely different mechanism for absolute positioning, for that matter? (I tried leaving a bug report in the textpos repo, but that repo has since been deleted…)

4
  • Are all of your content in textblocks? Or do you also want to use normal content in your frame? Jul 19 at 15:45
  • That is flexible. My main objective is having absolute positioning in Beamer, interacting nicely with overlays (and ideally more efficient than TikZ positioning); beyond that, I can change most things. It would be great to be able to mix “normal” content with absolutely positioned content (z-axis-wise), but that seems challenging. For now, I have a single textblock positioning a single coffin, and I position other coffins relative to that. Using normal Beamer mechanisms for, say, page numbers (outside textblock) would be good – but not crucial. Jul 21 at 9:36
  • I suppose one thing that would solve things for me (at least to a large extent) would be to have textpos's overlay option work with \pause and friends. It's OK that the contents are typeset after everything else – the main point is that the segments should be typeset in the correct order. (I guess I could look into the implementation of the overlay option.) Jul 21 at 10:25
  • I have a solution that I'm not 100% happy with, but that does seem to get the job done, without textpos, by typesetting a coffin in beamer's headline. This requires eliminating spacing above/to the left of that, and then reinserting that spacing when typesetting any actual textual content in the headline. Jul 31 at 10:34
0

I think maybe I have a solution, after all. It seems that simply using atbegshi with xcoffins (or l3coffins) is sufficient, and does the job correctly. In my code, I work with two coffins: One that is placed by atbegshi, at an absolute position, and another that is used to add contents incrementally to the first, possibly scaled, rotated, etc., using \ScaleCoffin, \RotateCoffin, etc., with configurable offsets and whatnot.

To just illustrate the basic functionality, however, here's a simple example using just a single coffin, placed at the center of the frame.

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty

% xcoffins may be useful, beyond l3coffins, if you need \TotalHeight, etc.
\usepackage{xcoffins}
%\usepackage{atbegshi} % imported by beamer

\NewCoffin \CenteredCoffin

% A couple of global commands that aren't available in xcoffins:
\ExplSyntaxOn
\NewDocumentCommand \GlobalSetHorizontalCoffin { m +m } {
    \hcoffin_gset:Nn{#1}{#2}
}
\NewDocumentCommand \GlobalClearCoffin { m } {
    \coffin_gclear:N{#1}
}
\ExplSyntaxOff

% Place the coffin at a given offset from the upper left of the shipout
% box, and then clear its contents (ready for its next definition/use):
\AtBeginShipout{%
    \AtBeginShipoutUpperLeftForeground{
        \TypesetCoffin\CenteredCoffin[hc,vc](.5\pdfpagewidth,-.5\pdfpageheight)
        \GlobalClearCoffin\CenteredCoffin
    }
}

\begin{document}
\begin{frame}
\GlobalSetHorizontalCoffin \CenteredCoffin {%
    \scalebox{10}{1 \pause 2 \pause 3}%
    \onslide<1->% Reset things, so the following content isn't paused
}

\color{black!10}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit
amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata
sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur
sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo
dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est
Lorem ipsum dolor sit amet.
\end{frame}
\end{document}

The three resulting slides are as follows:

1

1 2

1 2 3

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.