Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Note: the red lines have the same length.

alt text

\documentclass{minimal}
\usepackage[showframe,paperwidth=4cm,paperheight=4cm,margin=1cm]{geometry}
\begin{document}
%
\vspace*{\fill}%
\fbox{test}%
\vspace*{\fill}%
%
\end{document}
share|improve this question

2 Answers 2

up vote 11 down vote accepted

I think the difference you observed came from the \topskip that is automatically inserted. You can see the effect by commenting and uncommenting the \topskip0pt macro below.

\documentclass{minimal}
\usepackage[showframe,paperwidth=4cm,paperheight=8cm,margin=1cm]{geometry}
\usepackage{lipsum}
\newcommand{\vstretch}[1]{\vspace*{\stretch{#1}}}
\begin{document}
\topskip0pt
\vstretch{1}
\noindent\fbox{test}%
\vstretch{1}
\end{document}
share|improve this answer
    
Thanks. Yours is simpler than mine. –  xport Dec 17 '10 at 15:21
    
And thanks you for pointing out \topskip0pt as the source of problem. –  xport Dec 17 '10 at 15:27

I got the solution.

alt text

\documentclass{minimal}
\usepackage[showframe,paperwidth=4cm,paperheight=4cm,margin=1cm]{geometry}
\begin{document}%
\noindent%
\begin{minipage}[c][\textheight][c]{\textwidth}%
\centering\fbox{test}%
\end{minipage}%
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.