%20no%20aparece%20en%20la%20salida.png)
Mi código:
\documentclass{beamer}
\usepackage[absolute,overlay]{textpos}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{Demo}
\begin{textblock*}{\textwidth}(20mm,20mm)
\vspace{5mm}\hrule height 1mm\vspace{5mm}
\end{textblock*}
\end{frame}
\end{document}
Producción:
¿Por qué \hrule
no aparece en el resultado? ¿Cómo puedo arreglarlo?
Respuesta1
El textblock*
entorno utiliza las propiedades del contenido para determinar el tamaño del cuadro (aunque el textpos
manual indica que el ancho textpos*
es absoluto). La primitiva TeX \hrule
toma como ancho el ancho del cuadro vertical que encierra la \hrule
instrucción (ver¿Por qué una \hrule necesita texto alrededor para dibujarse?), que en este caso está vacío.
Las posibles soluciones son usar \leavevmode
(que establece el ancho del cuadro en \textwidth
, consulte la pregunta vinculada), especificar el ancho \hrule
manualmente o usar el comando \rule
con un ancho específico.
MWE a continuación, con algunos ejemplos de cómo textpos*
maneja diferentes tipos de contenido con fines ilustrativos (usando la showboxes
opción de paquete).
\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}