2.17 Lengths
A length register stores dimensions (such as 1in, 5cm,
8.25mm). Like control words, length registers
start with a backslash and only contain alphabetical characters in
their name. These registers are used to determine page layouts etc.
For example, the paragraph indentation is given by the length
register \parindent
. Acceptable units of measurement are listed
in Table 2.1. The two relative units “em” and “ex” are
dependent on the current font. (The em-value used to be the
width of an “M” and the ex-value was the height of the letter
“x”, but these days the values are more
arbitrary [6].) Use em for widths and
ex for heights if you want to use relative values.
To change a length you can use the command:
where <cmd> is the register (for example, \parindent
)
and <length> is the new length. Alternatively, you can add a
value to a length using:
The value of a length register can be displayed in your document using
\the
<register>
A rubber length is a length that has a certain amount of elasticity. This enables you to specify your desired length but allows LaTeX to stretch or contract the space to get the body of text as flushed with the margins as possible.
[Zero paragraph indent]For example, the paragraph gap \parskip
is usually set to
0pt plus 1pt. This means that the preferred gap is
0pt but LaTeX can stretch it up to 1pt to help prevent the
page from having a ragged bottom. For example:
\setlength
{\parindent
}{0pt}
\setlength
{\parskip
}{10pt plus 1pt minus 1pt}
This is the first paragraph.
This is the second paragraph.
The paragraph indentation is
\the
\parindent
.
This now produces:
\parskip
explicitly as it can cause unexpected complications. If you use one
of the KOMA-Script classes, such as scrreprt, you can use the
parskip class option that can take the following values:
parskip=full (a full line height) parskip=half
(half a line height).2.6
Example:
If you want to change any of the page layout lengths (such as
\textwidth
), the easiest way to do it is to use the
geometry package. This package should have been installed
when you installed your TeX distribution. For example: suppose you want the total text
area to be 6.5in wide and 8.75in high with a left margin of 0.4in, then you would do:
Footnotes
- ... height).2.6
- There are also variants that have +, - or * as a suffix. See the KOMA-Script documentation for further details.
This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-00-5).