Sunteți pe pagina 1din 3

LaTeX Tricks: Page Set-up

Page 1

Page Set-up
The default setting of the article and report options for the \documentstyle are pretty good. They let you produce a not-too-bad-looking document. But, of course, you'll want to change them eventually. Except for the thesis settings, but that's another story all together. Here's some things you can change: margins headers paragraphs, indenting [Table of Contents]

Margins
Each \documentstyle has its own default page set-up. Everything can be changed, though. You just have to know the right code words. Lengths are generally of the form \foo. That is, when latex reads \foo, it replaces it with whatever length \foo has been set to.

Notes 1. Don't forget to specify a unit of measurement when you set all the lengths:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \oddsidemargin 0.0in \evensidemargin 0.0in \textwidth 6.5in \headheight 0.0in \topmargin 0.0in \textheight=9.0in %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

You can use both \textheight=9.0in or \textheight 9.0in with just a space. 2. The distance from the left side of the page to the left side of the text is one inch + \oddsidemargin. You can set \oddsidemargin negative to make margins smaller than one inch. To change the right margin, just combine \oddsidemargin and \textwidth. You can make a binding offset this way, leaving some extra room for the binding, 3-holes, staples... 3. For documents with even and odd pages, use both \evensidemargin and \oddsidemargin. 4. The vertical style parameters are a bit mysterious. Setting \topmargin=0in doesn't actually pull the text right up to the top of the page, even if you have no obvious headers. Experiment a bit...

Headers
The official word on headers comes from Lamport (p. 161). You can get headers with the \pagestyle command: \pagestyle{style}. Styles
plain

Empty header, footer has page number. Default.


empty

http://www.iam.ubc.ca/old_pages/newbury/tex/page-set-up.html

8/31/2012 11:38:15 PM

LaTeX Tricks: Page Set-up Empty header and footer.


headings

Page 2

Header is defined in the \documentstyle. It usually has the chapter or section name, and the page number. Empty footer. See Lamport, p.162.
myheadings

This is where you can get fancy. With myheadings, you get whatever the default is, plus anything you add with \markboth{left}{right} (appears on left and right pages) or \markright{right} (appears on right pages only). Here are some example; modify them to suit your needs... 1. Section title on the left, page number on the right.

\documentstyle{article} \pagestyle{myheadings} % Go for customized headings \newcommand{\sekshun}[1] % In 'article' only the page { % number appears in the header. \section{#1} % I want the section name AND \markboth{#1 \hfill}{#1 \hfill} % the page, so I need a new kind } % of '\sekshun' command. \begin{document} \sekshun{Introduction} % Start new section with custom \sekshun

Under closer scrutiny in the early 20th century, Newton's Theory of Gravitation...

2. Chapter, Title, today's date (using \today), and page number. Notice the equal spacing around the date and the use of \thechapter to get the number of the chapter. (courtesy of Susan Haigh)

\documentstyle{thesis} \pagestyle{myheadings} % Go for customized headings \newcommand{\newchap}[1] % Re-define the chaptering command to use { % THESE headers. \chapter{#1} \markboth{Chapter \thechapter. {#1}\hfill \today\hfill}{Chapter \thechapter. {#1}\hfill \today \hfill} } \begin{document} \newchap{Introduction} % Start new chapter with custom \newchap

...evolution of these instabilities since it is only valid when the perturbation amplitudes are ...

Paragraphs and Indenting


No big mystery here. Everytime LaTeX hits a blank line in the .tex source file, it starts a new paragraph. By default, new paragraphs are indented, except for the first paragraph of a new chapter, section, subsection... You can force LaTeX to not indent by starting the block of text with \noindent. This is good to use after a displayed equation where you want to continue along, "where x is the value of blah blah blah." Of course, you can change the default indentation with

http://www.iam.ubc.ca/old_pages/newbury/tex/page-set-up.html

8/31/2012 11:38:15 PM

LaTeX Tricks: Page Set-up


\parindent=1in

Page 3

to set the indentation to, say, 1 inch. Setting \parindent=0in ( don't forget the unit of measurement, even with 0) turns off paragraph indentation all together. [Table of Contents] [Top of Page Set-up] Peter Newbury e-mail: newbury@math.ubc.ca Last update: 31 July 1995

http://www.iam.ubc.ca/old_pages/newbury/tex/page-set-up.html

8/31/2012 11:38:15 PM

S-ar putea să vă placă și