Some LaTeX page style parametersCustomizing the LaTeX page layoutAn example of modifying the LaTeX page layout

An example of modifying the LaTeX page layout

In order to change the page layout, you need to know how LaTeX views the printed page. For historical reasons, LaTeX considers the upper left-hand corner of the printed material on the page to be one inch over from the left-hand edge of the physical page and one inch down from the top edge of the physical page. There is a header (possibly empty) across the top of the printed page, a footer (possibly empty) across the bottom of the printed page, and the body of the text in between.

To change a LaTeX page-style parameter, you use the \setlength command in the preamble of your LaTeX source file. For example, if you want the body of the text to be 14 centimeters wide, you type \setlength{\textwidth}{14cm} in the preamble of your LaTeX source file. To get a feel for how this works, use the mouse to copy the following example into your text editor, save the example as a file named poem.tex, and execute the commands latex poem and xdvi poem & in a terminal window. (These commands are appropriate for a Unix system; if you are working on another platform, replace xdvi with the appropriate command to start the screen previewer on your system.)


\documentclass[12pt]{article}

\setlength{\textwidth}{14cm}

\begin{document}
\begin{verse}
Euclid alone has looked on Beauty bare.\\
Let all who prate of Beauty hold their peace,\\
And lay them prone upon the earth and cease\\
To ponder on themselves, the while they stare\\
At nothing, intricately drawn nowhere\\
In shapes of shifting lineage; let geese\\
Gabble and hiss, but heroes seek release\\
From dusty bondage into luminous air.\\
O blinding hour, O holy, terrible day,\\
When first the shaft into his vision shone\\
Of light anatomized! Euclid alone\\
Has looked on Beauty bare. Fortunate they\\
Who, though once only and then but far away,\\
Have heard her massive sandal set on stone.

\hfill \emph{Edna St.~Vincent Millay}
\end{verse}
\end{document}

Now change the \textwidth to 7 cm, save the file, run latex poem and xdvi poem & again to see what happens. If you make the text width negative via \setlength{\textwidth}{-14cm} what do you think will happen? Try it and see. What happens if you make the text width ridiculously big via \setlength{\textwidth}{100cm}?


logo The Math 696 course pages were last modified April 5, 2005.
These pages are copyright © 1995-2005 by Harold P. Boas. All rights reserved.
 
Some LaTeX page style parametersCustomizing the LaTeX page layoutAn example of modifying the LaTeX page layout