Page layout in Plain TeX

can be done as follows:

1. Set the page dimensions:*
% settings for A5 paper
\pdfpagewidth 148mm
\pdfpageheight 210mm


* See here for the dimensions used in TeX.

2. Set the size of the text block:
\hsize 99mm% width of text block; line length or measure.
\vsize 164mm% height of text block

The default settings for the text block are \hsize=6.5in, \vsize=8.9in.

3. Position the text block on the page by adjusting \voffset and \hoffset.

Plain TeX’s default setting positions the text block one inch down from the top of the page (\voffset=0pt) and one inch in from the left side of the page (\hoffset=0pt). Assigning positive values to \voffset and \hoffset increases these distances; assigning negative values decreases them.

Knuth’s TeX does not have any commands for setting the size of the page: \pdfpagewidth and \pdfpageheight are pdfTeX commands which happen also to work in XeTeX. On American letter paper (8.5 inch × 11 inch) Plain TeX’s default settings produce a text block measuring 6.5 inch × 8.9 inch with left, right and top margins all equal to 1 inch and a bottom margin approximately equal to 1.1 inch.

Depending on where you live and how TeX is set up, the default page size will be A4 or American letter size. If you’re happy with this page size you can skip Step 1.

Some page layouts:

B format (trade paperback – ‘Large Crown Octavo’):

%+++++++++++++++++++++++++++++++++++++++++++
% page layout
\pdfpagewidth 129mm
\pdfpageheight 198mm

\hsize 99mm
\vsize 161mm

\voffset -9.4mm
\output{\ifodd\pageno\hoffset -11.4mm\else\hoffset -9.4mm\fi
\plainoutput}

% to adjust the space between the header and the text block
\def\makeheadline{\vbox to 0pt{\vskip-22.5pt
\line{\vbox to8.5pt{}\the\headline}\vss}\nointerlineskip}

% to adjust the space between the footer and the text block
\def\makefootline{\baselineskip24pt\lineskiplimit0pt\line{\the\footline}}
%+++++++++++++++++++++++++++++++++++++++++++

The text block is set 16mm from the top of the page: \voffset -9.4mm, i.e. the Plain TeX default of 1 inch (25.4mm) minus 9.4mm.

This code alternates \hoffset on odd- and even-numbered pages for mirrored page output (like the LaTeX book Document Class):

\output{\ifodd\pageno\hoffset -11.4mm\else\hoffset -9.4mm\fi
\plainoutput}


On odd-numbered (recto) pages the left margin is 14mm (25.4mm − 11.4mm). On even-numbered (verso) pages the left margin is 16mm (25.4mm − 9.4mm). The 16mm is calculated by subtracting \hsize and the left margin of the recto (= right margin of verso) from the page width (129mm − 99mm − 14mm = 16mm).

So you end up with: spine margin of recto = spine margin of verso = 14mm; and fore-edge margin of recto = fore-edge margin of verso = 16mm. Here is a drawing to illustrate what I mean (right click for a larger view):

Usually in a book the spine margin is narrower than the fore-edge margin, and the two pages of a spread mirror each other. If you want to have the text block horizontally centered in the page you can subtract the width of the text block from the width of the page and divide the result by two: (129mm − 99mm) ÷ 2 = 15mm. The page layout then becomes:

\pdfpagewidth 129mm
\pdfpageheight 198mm

\hsize 99mm
\vsize 161mm

\hoffset -10.4mm
\voffset -9.4mm

You can adjust the dimensions in \def\makeheadline and \def\makefootline to change the amount of space between the header and the text block and the text block and the footer respectively. Plain TeX’s default setting is to have a lineskip (12pt) between the header and the text block and a lineskip between the text block and the footer. See page 255 of the TeXbook for an explanation of the dimensions in \makeheadline.

Adjustments to \vsize
When I used the original \vsize (161mm) for this document I noticed that there is some slack between the text block and the footer (the page number was a bit lower than it ought to be). This is probably because 161mm is slightly bigger than the space taken up by the number of lines on the page. I got the 161mm measurement from measuring a book. A way to correct this is to get the height of the text block in points by multiplying the leading (\baselineskip) by the number of lines on a full page. But don’t forget that \topskip sets the baseline of the first line 10pt down from the top of the text block. (The first line of a page does not need to have leading above it.) So, if there are n lines in a page, the height of the page in points can be got by [(n – 1) × \baselineskip] + 10pt. In this example n = 38, and (37 × 12pt) + 10pt = 454pt.

\looseness1 at the beginning of the second paragraph on page one of B_format.tex is to avoid a widow line that would otherwise appear at the top of page two. (It makes the paragraph one line longer.)


For comparison, here is the same layout in LaTeX with the geometry package:
\usepackage[paperheight={198mm}, paperwidth={129mm}, height={454pt}, width={99mm}, top={16mm}, left={14mm}, headsep={10.5pt}, footskip={24pt}]{geometry}

Files: B_format.tex, B_format.pdf; B_format_latex.tex, B_format_latex.pdf

Penguin:

Small paperback format used by Penguin books c. 1940s–1980s. And used now in their ‘Great Ideas’ series and in the relaunched Pelican imprint.
Files: Penguin.tex, Penguin.pdf.

216x138 (Demy):

Files: 216x138.tex, 216x138.pdf.

210x140 (American book size: 8¼″ × 5½″):

Files: 210x140a.tex, 210x140a.pdf.
210x140b.tex, 210x140b.pdf.

9″x6″:

Files: 9x6.tex, 9x6.pdf.

isogolden:

Page layout for a golden ratio text block on an A5 page.
Files: isogolden.tex, isogolden.pdf.


Page Furniture – Headers and Footers

\headline defines a headline (header) for the page. Plain TeX’s default setting is an empty header: \headline={\hfil}

\footline defines a footline (footer) for the page. Plain TeX’s default setting is to have the page number centered in the footer: \footline={\hss\tenrm\folio\hss}

Some settings for the header:

i.

This macro (a) sets different headers for left- and right-hand pages using the \ifodd conditonal; (b) sets the page numbers at the right side of the header on right-hand pages and vice versa for left-hand pages; (c) centres the text of the header over the text block, regardless of how much space the page numbers take up. The footer is empty.

\font\headerfont="EB Garamond 12 Regular:
+smcp,letterspace=6,mapping=tex-text" at 10pt

% macros to set the texts of the headers.
% \headerfont puts the text into a letterspaced smallcap font.
\def\lheader{\headerfont great expectations}
\def\rheader{\headerfont chapter i}

\headline={% % Do different headers for odd and even pages
\ifodd\pageno
% header for right-hand page
\rm\rlap{\centerline{\rheader}}\hss\folio%
\else
% header for left-hand page
\rm\folio\hss\llap{\centerline{\lheader}}%
\fi
}

\footline={}


ii.

The header ranged right on a right-hand page and vice versa on a left-hand page, with the page numbers hung out into the margin.

\def\lheader{Great Expectations}
\def\rheader{Chapter II}

\headline={% % Do different headers for odd and even pages
\ifodd\pageno
% header for right-hand page
\rm\hfil\rheader\rlap{\hbox to 8.5mm{\hfil\folio}}%
\else
% header for left-hand page
\rm\llap{\hbox to 8.5mm{\folio\hfil}}\lheader\hfil%
\fi
}

\footline={}


In the macro above, if you change

\rm\hfil\rheader\rlap{\hbox to 8.5mm{\hfil\folio}}%
to
\rm\hfil\rheader\rlap{\lower12pc\hbox to 8.5mm{\hfil\folio}}%
and
\rm\llap{\hbox to 8.5mm{\folio\hfil}}\lheader\hfil%
to
\rm\llap{\lower12pc\hbox to 8.5mm{\folio\hfil}}\lheader\hfil%

you can have the page numbers set in the fore-edge margin. This just uses \lower to push down the \hbox containing the page number 12 picas.

iii.

The header and page number ranged right on a right-hand page and vice versa on a left-hand page, with an ornament and some space between them.

\font\headerfont="EB Garamond 12 Regular/I:mapping=tex-text" at 10pt

\def\lheader{\headerfont Great Expectations}
\def\rheader{\headerfont Chapter {\sci iii}}

\headline={% % Do different headers for odd and even pages
\ifodd\pageno
% header for right-hand page
\rm\hfil{\rheader}\quad$\diamond$\quad\folio%
\else
% header for left-hand page
\rm\folio\quad$\diamond$\quad{\lheader}\hfil%
\fi
}

\footline={}

Examples in these files: headers.tex, headers.pdf.

See the file ‘prelims.tex’ on the PDF page for a method of automatically switching off headers on the first page of the chapter (in the \chapter and \headline macros).

Some settings for the footer:

Plain TeX centres the page number in the footer by default.

Variations:

Centered but with en dashs either side of the page number:
\footline={\rm\hss--\kern3pt\folio\kern3pt--\hss}

Or brackets:
\footline={\rm\hss[\kern2pt\folio\kern2pt]\hss}

The page number ranged right on a right-hand page, and to the left on a left-hand page:

\footline={%
\ifodd\pageno
\rm\hss\folio% footer for right-hand page
\else
\rm\folio\hss% footer for left-hand page
\fi
}


The same as the previous example, but with the page numbers set in from the edge of the text block by an em:

\footline={%
\ifodd\pageno
\rm\hss\folio\quad% footer for right-hand page
\else
\rm\quad\folio\hss% footer for left-hand page
\fi
}


The same as the example before last, but with an ornament and some space before the page number:

\footline={%
\ifodd\pageno
\rm\hss$\diamond$\enspace\folio% footer for right-hand page
\else
\rm\folio\enspace$\diamond$\hss% footer for left-hand page
\fi
}