The geometry directive provides an easy and flexible interface to customize page layout. It uses the LaTeX geometry package and it's description here is a (modified) part of the geometry package documentation.
The geometry directive implements auto-centering and auto-balancing mechanisms so that the users have only to give the least description for the page layout. In this case, what you have to do is just
{geometry:a4paper} |
In addition to this centering problem, setting margins from each edge of the paper is also troublesome. However, with geometry package, you can do
{geometry:margin=1.5in} |
if you want to set each margin 1.5in from each edge of the paper.
Lengths can be written in
Centimeters (cm)
Millimeters (mm)
Inches (in)
Points (pt)
To realize a straightforward setting for page layout, the following page structure is introduced: A paper contains a total body (printable area) and margins. The total body consists of a body (text area), a header, a footer and a marginal note which is optional. There are four margins: left-, right-, top- and bottom-margin.
paper: total-body (printable area) and margins total-body: head, body(text area), foot and marginal notes margins: left-, right-, top- and bottom-margin |
Each margin is measured from the corresponding edge of a paper. For example, left-margin means a horizontal distance between the left edge of the paper and that of the total body. The dimensions for paper, totalbody and margins have the following relations.
paperwidth = left + width + right paperheight = top + height + bottom |
Table 5-1. Options for geometry directive
landscape | switches the paper orientation to landscape mode |
portrait | switches the paper orientation to portrait mode |
twoside | switches on two-sided printing. In this mode, specified left and right margins are switched over in each odd-numbered page. |
reversemp | makes the marginal notes appear in the left margin |
nohead | eliminates spaces for the head of page |
nofoot | eliminates spaces for the foot of page |
noheadfoot | eliminates spaces for the head and foot of page |
a4paper, a5paper,letterpaper, legalpaper | specifies paper name. They must be used with no values. |
paperwidth | width of the paper. paperwidth=<paperwidth> |
paperheight | height of the paper. paperheight=<paperheight> |
width | width of the total body. width=<width>or totalwidth=<width>. This dimension should not be confused with textwidth, because width includes the width of marginal notes |
height | height of the total body (including header and footer). height=<height> |
left | left margin of the total body. In other words, the distance between the left edge of the paper and that of the total body.left=<leftmargin> |
right | right margin of the total body. right=<rightmargin> |
top | top margin of the total body. top=<topmargin> |
bottom | bottom margin of the total body. bottom=<bottommargin> |
margin | sets all margins of the total body. margin=<margin> |
textwidth | modifies width of text (body). textwidth=<width> |
textheight | modifies height of text (body). textheight=<height> |
marginpar | modifies width of the marginal notes. marginpar=<length> |
marginparsep | modifies separation between body and marginal notes. marginparsep=<length> |
head | modifies height of header. head=<length> |
headsep | modifies separation between header and text (body). headsep=<length> |
foot | modifies distance separation between baseline of last line of text and baseline of footer. foot=<length> |
Set the height of the total body to be 10in, the bottom-margin 2cm, and the width default. The top-margin will be calculated automatically:
{geometry:height=10in,bottom=2cm} |
or
{g:height=10in,bottom=2cm} |
or
{geometry:height=10in} {g:bottom:=2cm} |
Set the left-, right-, and top-margin 3cm, 2cm and 2.5in respectively. The page header is not used.
{geometry:left=3cm,right=2cm, nohead, top=2.5in} |
or
{geometry:left=3cm} {geometry:right=2cm} {geometry:nohead} {geometry:top=2.5in} |
or
{g:left=3cm,right=2cm} {g:nohead, top=2.5in} |
and so on ...
Modify the width of marginal notes to 3cm and include marginal notes when adjusting horizontal partition
{geometry:marginpar=3cm} |
{geometry:marginpar=3cm, reversemp} |
makes the marginal notes appear in the left margin.
Use A5 paper in landscape mode.
{geometry:a5paper, landscape} |