0

I would like to have absolute positioning with centering vertical alignment. I am trying to achieve this by using a \parbox inside a \textblock (from textpos):

\documentclass{article}
\usepackage[absolute,overlay,showboxes]{textpos}
\begin{document}
    \setlength{\fboxsep}{0pt}
    \begin{textblock*}{1in}(1in,1in)\noindent
        \fbox{\parbox[c][1in][c]{1in}{Hallo}}
    \end{textblock*}
\end{document}

However, it the widths of the textblock and the parbox do not match. Does anybody know where this unwanted extra spacing comes from and how to remove it? enter image description here

4

You have a word space after the fbox, which I comment out here, and you need to allow for the width of the fbox rules

\documentclass{article}
\usepackage[absolute,overlay,showboxes]{textpos}
\begin{document}
    \setlength{\fboxsep}{0pt}
    \begin{textblock*}{1in}(1in,1in)\noindent
        \fbox{\parbox[c][\dimexpr 1in-2\fboxrule][c]{\dimexpr 1in-2\fboxrule}{Hallo}}%
    \end{textblock*}
\end{document}

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.