The textblock*
environment uses the properties of the content to determine the size of the box (even though the textpos
manual states that the width of textpos*
is absolute). The TeX primitive \hrule
takes as width the width of the of the vertical box that encloses the \hrule
instruction (see Why does a \hrule need text around it to be drawn?), which is empty in this case.
Possible solutions are to use \leavevmode
(that sets the width of the box to \textwidth
, see the linked question), or specify the width of the \hrule
manually, or to use the command \rule
with a specified width.
MWE below, with some examples of how textpos*
handles different types of content for illustration purposes (using the showboxes
package option).
\documentclass{beamer}
\usepackage[absolute,overlay,showboxes]{textpos}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{Demo}
\color{green}\vspace{5mm}\hrule height 1mm\vspace{5mm}
\begin{textblock*}{\textwidth}(10mm,20mm)
\vspace{2mm}\hrule height 1mm\vspace{2mm}% zero width
\end{textblock*}
\begin{textblock*}{\textwidth}(10mm,30mm)
\vspace{2mm}\leavevmode\hrule height 1mm\vspace{2mm}
\end{textblock*}
\begin{textblock*}{\textwidth}(10mm,40mm)
\color{red}\vspace{2mm}\hrule height 1mm width \textwidth\vspace{2mm}
\end{textblock*}
\begin{textblock*}{\textwidth}(10mm,50mm)
\color{blue}\rule{\textwidth}{1mm}
\end{textblock*}
%further examples of textblock*
\begin{textblock*}{\textwidth}(10mm,60mm)% width of the character
\phantom{X}
\end{textblock*}
\begin{textblock*}{\textwidth}(10mm,70mm)% does not show
\end{textblock*}
\begin{textblock*}{\textwidth}(10mm,80mm)% full width
\color{black}X
\end{textblock*}
\end{frame}
\end{document}
textblock
?overlayarea
in a single frame but I don't want to do that because these frames contain different ideas, so I want them to be separate frames. Combining them into a single frame does not reflect the notion that they contain different ideas (e.g., the frame number in the footer does not increment).