28.03.2013 Views

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

16.3. A model letter cus<strong>to</strong>mization 363<br />

\renewcomm<strong>and</strong>{\@evenhead}{}\renewcomm<strong>and</strong>{\@evenfoot}{}}<br />

This page style must (re)define the comm<strong>and</strong>s \@oddhead <strong>and</strong> \@oddfoot,<br />

which are always inserted at the <strong>to</strong>p <strong>and</strong> bot<strong>to</strong>m of odd pages, <strong>to</strong> place<br />

our special \firmhead <strong>and</strong> \firmfoot. The even pages are unimportant,<br />

since the first page is always odd. It is necessary <strong>to</strong> enlarge \headheight<br />

<strong>and</strong> \headsep <strong>to</strong> allow the big boxes <strong>to</strong> fit in.<br />

Subsequent pages are set with the headings or plain page styles. We<br />

want <strong>to</strong> modify the former <strong>to</strong> include the firm address once more.<br />

\renewcomm<strong>and</strong>{\ps@headings}<br />

{\setlength{\headheight}{41pt}%<br />

\renewcomm<strong>and</strong>{\@oddhead}<br />

{\parbox{\textwidth}{\usebox{\firm}\\[5pt]<br />

\slshape \head<strong>to</strong>name{} \<strong>to</strong>name\hfill\@date\hfill<br />

\pagename{} \thepage\\<br />

\rule[3pt]{\textwidth}{1pt}}}<br />

\renewcomm<strong>and</strong>{\@oddfoot}{}<br />

\renewcomm<strong>and</strong>{\@evenhead}{\@oddhead}<br />

\renewcomm<strong>and</strong>{\@evenfoot}{\@oddfoot}}<br />

One small problem remains: the first time one of these page style<br />

comm<strong>and</strong>s is executed, the head <strong>and</strong> foot comm<strong>and</strong>s may not yet exist,<br />

causing \renewcomm<strong>and</strong> <strong>to</strong> complain. We ensure that they are there at<br />

the start by predefining them with \providecomm<strong>and</strong> (Section 8.3.1).<br />

\providecomm<strong>and</strong>{\@evenhead}{}\providecomm<strong>and</strong>{\@oddhead}{}<br />

\providecomm<strong>and</strong>{\@evenfoot}{}\providecomm<strong>and</strong>{\@oddfoot}{}<br />

Now make headings the active page style.<br />

\pagestyle{headings}<br />

There is only one last thing <strong>to</strong> do, <strong>and</strong> that is <strong>to</strong> redefine the opening<br />

comm<strong>and</strong> that prints the recipient’s address <strong>and</strong> the salutation. We add<br />

a bit more, including the personal data of the sender, as well as the<br />

reference information. The address goes in the left field, the personal<br />

data <strong>to</strong> the right. The references go in a line below the rule, followed by<br />

the subject line. These entries are tested first, <strong>and</strong> are only included if<br />

they are not blank. Several s<strong>to</strong>red entry comm<strong>and</strong>s used here are part<br />

of the st<strong>and</strong>ard letter class, such as \<strong>to</strong>name <strong>and</strong> \<strong>to</strong>address. The<br />

\@date entry is either \<strong>to</strong>day or whatever text was s<strong>to</strong>red with \date.<br />

\renewcomm<strong>and</strong>{\opening}[1]{\thispagestyle{firstpage}%<br />

\parbox[t]{\leftfield}<br />

{\usebox{\firmreturn}\\<br />

\parbox[b][3.5cm][c]{\leftfield}{\<strong>to</strong>name\\\<strong>to</strong>address}}%<br />

\parbox[t]{\rightfield}<br />

{\fromname<br />

\ifthenelse{\equal{\telephonenum}{}}<br />

{}{\\ Tel.: \telcode-\telephonenum}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!