Skip to main content

The PreTeXt Guide

Section 41.3 Page Shape

Various dimensions of a printed page, including the page itself, may be adjusted using the geometry package, so study the documentation of this package to explore possibilities. The options of this package may be also set on the command line. To make options part of your style, place the <xsl:param> declaration in your stylesheet as follows (note the two sets of quotes):
<xsl:param name="latex.geometry" select="'foo'"/>
This will have the effect of placing the following line into the preamble of the resulting output file, in the right place:
\geometry{foo}
Of course, you will want to use something meaningful, such as
<xsl:param name="latex.geometry" select="'a4paper,total={16cm,25cm}'"/>
to produce in the output
\geometry{a4paper,total={16cm,25cm}}
This is typical and illustrates two important universal points. First, PreTeXt puts surrounding infrastructure in place. In this case the geometry package is loaded, and in an order that does not cause conflicts, plus the \geometry{} command itself is placed and output by PreTeXt. As a style writer, you simply provide the package options you desire. Second, “garbage in, garbage out.” It is very easy to make a typo in your style, and have the compilation fail. This is why we assume you are comfortable with compilation and debugging, and not every author should be a style writer.
Set the document font size first, for this will influence later choices. The string parameter, latex.font.size (which has pt as part of the value) will set an optimal line width. This line width should translate to about 75 characters per line, at the upper end of recommendations for an optimal width. It will also match closely (but not exactly) to line lengths in HTML output. You can look into the output before you experiment to see the value used when the stock \geometry{} command is issued. You are certainly able to override this width, but read the next paragraph carefully.
This raises two important more universal points. You should expect to repeatedly examine the output as you develop a style. And most important—are you tempted to use a small font, and increase the line width so as to cram more material onto the page, so your book is shorter, and sells via print-on-demand for $7 rather than $8? Then you misunderstood that there are time-tested recommendations for the optimal number of characters per line for human readers, and we just counseled you that PreTeXt is already at the high end of these recommendations. You have a certain freedom as a style writer. Use it responsibly. Enhance the content provided by authors, don’t degrade it.
This is the place to think about headers and footers on the page, since you will want to make room for them, and with spacing away from the primary content. See Section 41.4.