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.

I am trying to fix two half-paged documents on one document, one on top of the other.

The method below works pretty well so far, but I'm having trouble using 0.5\textheight for the height of the second minipage. When I change 0.49 to 0.5, the second page breaks onto another page. What am I doing wrong? Is there a better way to achieve what I'm looking for?

\documentclass{article}
\usepackage[vmargin=0.4in]{geometry}
\pagestyle{empty}
\parindent = 0.0in

\begin{document}
    \begin{minipage}[t][0.5\textheight][t]{\textwidth}
        Page 1
    \end{minipage} \\
    \begin{minipage}[b][0.49\textheight][t]{\textwidth}
        \vspace{0.4in}
        Page 2
    \end{minipage}
\end{document} 
share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

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}.

share|improve this answer
    
Thanks for the trace tips. Adding \hbox{}\kern-\topskip before the beginning of the document seemed to work. –  Trey Hunner Oct 18 '10 at 8:28
add comment

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.

share|improve this answer
    
The \vbox and nointerlineskip method works for me and the \null\kern-\topskip\nointerlineskip alternative also works if I add it before the document. Thanks! –  Trey Hunner Oct 18 '10 at 15:02
add comment

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.