Spliting a page in half horizontally

If you wrap the two minipages in a \vbox and look at the output, the vbox is overfull by just under 1pt.

The real problem is that the two boxes (that is to say the two minipages) are less than \lineskiplimit apart so TeX inserts \lineskip glue between them. The way to handle this is to put \nointerlineskip before the second minipage like this.

\vbox{
    \begin{minipage}[t][0.5\textheight][t]{\textwidth}
        Page 1
    \end{minipage}

    \nointerlineskip
    \begin{minipage}[b][0.5\textheight][t]{\textwidth}
        \vspace{0.4in}
        Page 2
    \end{minipage}
}

Leaving the \vbox there handles the issue with the \topskip.

Alternatively, you can remove the \vbox and add \null\kern-\topskip\nointerlineskip in its place. Again, the \nointerlineskip is necessary to keep TeX from trying to put space between the null hbox and the first minipage.


Adding the lines

\tracingoutput=1
\showboxdepth=3
\showboxbreadth=99

to the preamble and then looking in the log file is instructive. Here is the contents of the main text block:

..\vbox(737.15489+0.0)x430.00462, glue set 3.20049fil
...\write-{}
...\glue(\topskip) 3.16669
...\hbox(6.83331+361.74413)x430.00462 []
...\penalty 300
...\glue(\lineskip) 1.0
...\hbox(361.20995+0.0)x430.00462 []
...\glue 0.0 plus 1.0fil
...\glue 0.0
...\glue 0.0 plus 0.0001fil

So \topskip and lineskip glue are clearly the culprits here.

You can turn off \topskip glue for a given page by starting it with

\hbox{}\kern-\topskip

and you can turn off interlineskip for a given paragraph by ending it with {\offinterlineskip\par}.

Tags:

Minipage