Department of Mathematics

Math 300: Mathematical Computing

LaTeX Spacing and Fonts

We always need to be able to change the style of our document, and LaTeX provides many commands and variables to do so.

Variables

These variables control many aspects of the presentation of your page. You set them by using an equals sign: \variable=distance. For example, \textwidth=6.5in.

\textwidth
This sets the width of the text on the page. It should be changed only in the preamble.
\evensidemargin
This sets the left margin on even-numbered pages. It should be changed only in the preamble.
\oddsidemargin
This sets the left margin on odd-numbered pages. It should be changed only in the preamble.
\baselineskip
This is the minimum space from the bottom of one line to the bottom of the next. It may be changed anywhere.
\parindent
The width of the indentation at the beginning of a paragraph. It may be changed anywhere.
\parskip
This is the amount of extra vertical space to insert before a paragraph. It may be changed anywhere, but use caution. It is stretchable, so it should be set e.g. as
\parskip=.2in plus .1in
\raggedright
If this statement appears, then LaTeX does not require justification on the right side of the page.

Figure 1 shows a detailed annotation of a page layout. See Wikibooks for details.

Commands

There are also many commands to set spacing and make effects. As a general rule, you set variables to affect the style of the entire document, while you use commands to get one-time effects.

\hspace{distance}
This puts a horizontal space of the width given in the argument at the point where the command appears. The space could be negative.
\vspace{distance}
This puts a vertical space of the height given at the point where LaTeX must next use vertical mode (usually the end of the current line).
\hfill
Fills a line up with space. This works when there is a clear beginning and end of the line. If the line is long, or embedded in a paragraph, this command does little or nothing, but in
{Left\hfill Right}
the \hfill pushes the word "Left" to the left margin, and "Right" goes to the right margin.
\vfill
Fills a page up with space. Again, this works if there is a clear beginning and end to the page. If the page is one of many, this command may have little effect.
\raisebox{distance}{text}
Raises text the specified distance above the baseline. The distance could be negative.

Fonts

LaTeX has a powerful, albeit inconvenient, font capability. There are many fonts available, and metafont can adapt them on the fly.

\newfont{\newname}{fontfile}
This allows us to use fonts. We can look for font files (ending with .pfb or .tfm, for example, and found in e.g. /usr/share/texmf/fonts on linux), and then load them into our document for use any time. For example, the following loads a certain helvetic font and then uses it henceforth for standard-sized text.
\newfont{\helv}{pfvfro}
\helv
\usepackage{fontpackage}
This is a better way to change font styles for an entire document. It load a collection of fonts of different sizes, escapements, and weights, and uses them consistently. By contrast, defining a font using /newfont only loads a single font of a specific size. Font packages include times, palatino, helvetic, avant, cmbright, bookman, charter, newcent, utopia, and others.


Assignment 6 is posted.




The midterm exam will take place Monday, 16 October. As with all exams, all paper notes may be used, but no electronic devices are permitted. There is a sample exam available.



Department of Mathematics, PO Box 643113, Neill Hall 103, Washington State University, Pullman WA 99164-3113, 509-335-3926, Contact Us
Copyright © 1996-2015 Kevin Cooper