Section 30.6 Page Shape
The conversion to
LaTeX defaults to US Letter paper with reasonable margins. However, the
LaTeX geometry
package 1 has numerous options for paper sizes and margins. The publication file can be used to insert any configuration the package supports. See
Subsection 44.3.4 for the exact syntax.
Note that if you change the paper size, you may want to change the text width computed by PreTeXt, and the more changes you make, the more default settings you may need to adjust. However, if you are producing your book for print-on-demand (
Chapter 43) getting the page size and margins just right is a key step of the process.
Note also that when you use the <geometry>
element of the publication file, the content of the element (text between the opening and closing tags) will be duplicated exactly into a LaTeX source file. Being careless here is a good explanation for the LaTeX compilation step to fail.
Here is an example:
<latex>
<page>
<geometry>a4paper,total={16cm,25cm}</geometry>
</page>
</latex>
twhich will produce in the LaTeX output
\geometry{a4paper,total={16cm,25cm}}
An electronic
PDF may be printed on physical paper, but perhaps you want to make a version that works well on a portable device that naturally supports a portrait orientation, such as an Android tablet, an iPad, a Kindle (device or application), smart phone, Sony Digital Paper, or a ReMarkable tablet. Aspect ratios vary across these devices, but once you settle on a target ratio, we have had good luck with the following algorithm and parameters:
Specify 10 point text
Text width of about 4.5 inches
Add quarter-inch left/right margins to compute text width
Use aspect ratio to compute an overall height (about 6.5 inches)
Subtract quarter-inch top and bottom margins to obtain text height
Then you can provide the
geometry
package the overall size as the
papersize
and the text width and text height as the
total
size of the body, resulting in equal (tight) margins all around, and good use of limited screen real estate. These parameters create a
PDF that is very legible on a larger smart phone, and for fine detail, rotating the device to landscape works well. Really.