About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account
Smile for the Camera: a new cybercrime short story ebook.


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.


Table 2.1: Units of Measurement
pt TeX point: 72.27pt = 1in
in inch: 1in = 25.4mm
mm millimetre: 1mm=2.845pt
cm centimetre: 1cm = 10mm
ex the “x-height” of the current font
em the width of a “quad” in the current font
sp scaled point: 1sp = 65536pt
bp big point (or PostScript point): 72bp = 1in
dd didôt point: 1dd=0.376mm
pc pica: 1pc=12pt
cc cicero: 1cc=12dd
mu math unit: 18mu = 1em


To change a length you can use the command:

\setlength{<cmd>}{<length>}

where <cmd> is the register (for example, \parindent) and <length> is the new length. Alternatively, you can add a value to a length using:

\addtolength{<cmd>}{<length increment>}

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:

Image showing typeset output

In this example, the preferred paragraph gap is 10pt but it will allow for a deviation of up to plus or minus 1pt.

Note that it's generally best not to change \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:

\documentclass[parskip=full]{scrbook}

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:

\usepackage[body={6.5in,8.75in},left=0.4in]{geometry}



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).

© 2012 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs