1

Consider the following example:

\documentclass[
  12pt,
  landscape
]{article}

\usepackage[
  a6paper,
  margin = 0cm
]{geometry}
\usepackage{lmodern}

\newenvironment{horse}
{
 \topskip0pt
 \vspace*{\fill}
 \begin{center}
 \fontsize{50}{56}\selectfont
 }
{
 \end{center}
 \vspace*{\fill}
 %
}

\pagestyle{empty}


\begin{document}

\begin{horse}
  Alle lande\\[0.5ex] og\\[0.5ex] deres hovedst{\ae}der
\end{horse}

\end{document}

output

I would like the contents of the horse environment to be placed vertically centered on the page. As can be seen if the code is compiled, this doesn't happen; how do I fix this?

P.S. I just "stole" the code from https://tex.stackexchange.com/a/2327/15874 and modified it a bit.

2 Answers2

1

A little simplified example (\centering instead of environment center and line ends commented):

\documentclass[
  12pt,
  landscape
]{article}

\usepackage[
  a6paper,
  margin = 0cm
]{geometry}
\usepackage{lmodern}

\newenvironment{horse}{%
  \setlength{\topskip}{0pt}%
  \centering
  \vspace*{\fill}%
  % \nointerlineskip
  \fontsize{50}{56}\selectfont
  % \sbox0{Alle lande}%
  % \showthe\ht0
}{%
  \par
  \vspace{\fill}%
  % \setlength{\showboxdepth}{\maxdimen}%
  % \setlength{\showboxbreadth}{\maxdimen}%
  % \tracingonline=1 %
  % \showlists
}

\pagestyle{empty}


\begin{document}

\begin{horse}
  Alle lande\\[0.5ex] og\\[0.5ex] deres hovedst{\ae}der
\end{horse}

\end{document}

Enabling the four lines with \showlists reveals:

### current page:
\write-{}
\glue(\topskip) 0.0
\rule(0.0+0.0)x*
\penalty 10000
\glue 0.0 plus 1.0fill
\glue 0.0
\glue(\parskip) 0.0 plus 1.0
\glue(\baselineskip) 21.83911
\hbox(34.16089+0.0)x421.10078, glue set 109.61919fil
.\glue(\leftskip) 0.0 plus 1.0fil
.\hbox(0.0+0.0)x0.0
.\OT1/lmr/m/n/50 A
.\OT1/lmr/m/n/50 l
.\OT1/lmr/m/n/50 l
.\OT1/lmr/m/n/50 e

All is fine except for the large contribution of the \baselineskip. The height of the first line is 34.16089pt, but the line spacing is 56pt. The difference is added on top of the first row:

\glue(\baselineskip) 21.83911

This can be turned off by \nointerlineskip. After enabling it in the code above, the result is:

Result

Heiko Oberdiek
  • 271,626
0

try

\newcommand\HUGE{\fontsize{50}{56}\selectfont}

\newenvironment{horse}
  {\vspace*{\fill}
   \centering\HUGE}
  {\vfill~\newpage}

enter image description here