Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've read through the Kopka & Daly book, "A Guide to LATEX", 3ed., and I'm attempting to re-crate the example custom letter that begins on page 305.

The custom-letter class "mpletter"

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mpletter}

\RequirePackage{ifthen}
\newboolean{@german}
\setboolean{@german}{false}
\DeclareOption{german}{\setboolean{@german}{true}}

%pass-in of letter.cls
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{letter}}
\ProcessOptions
\LoadClass[letter]{letter} %%changed for letter sized paper

%German names
\newcommand{\englishnames}{%
    \newcommand{\yrefname}{\textsl{Your Ref.}}
    \newcommand{\ymailname}{\textsl{Your letter from}}
    \newcommand{\myrefname}{\textsl{Our Ref.}}
    \newcommand{\subjectname}{\textsl{Subject}}
    \newcommand{\telephonename}{Telephone}
    \newcommand{\stationname}{Train Station}
    \newcommand{\germanname}{GERMANY}
    \newcommand{\telcode}{[49]-555-401}
    \newcommand{\postcode}{D--37191}
}
    \newcommand{\germannames}{%
    \newcommand{\telefax}{Telefax}
    \newcommand{\telex}{Telex}
    \newcommand{\telcode}{(05556) 401}
    \newcommand{\postcode}{37191}
}

\ifthenelse{\boolean{@german}}
    {\RequirePackage{german}\germannames}{\englishnames}

%Extra info. in the header
\newcommand{\@yref}{}
\newcommand{\@myref}{}
\newcommand{\@internet}{}
\newcommand{\@ymail}{}
\newcommand{\@subject}{}

%
\newcommand{\yref}[1]{\renewcommand{\@yref}{\yrefname: #1}}
\newcommand{\ymail}[1]{\renewcommand{\@ymail}{\ymailname: #1}}
\newcommand{\myref}[1]{\renewcommand{\@myref}{\myrefname: #1}}
\newcommand{\subject}[1]{\renewcommand{\@subject}{\subjectname: #1}}
\newcommand{\internet}[1]{\renewcommand{\@internet}{#1}}
\newcommand{\INTERNET}{@linmpi.mpg.de}

%set margins/text
\setlength{\textheight}{215mm}
\setlength{\textwidth}{160mm}
\setlength{\oddsidemargin}{0pt}
\setlength{\topmargin}{-20pt}
\setlength{\headsep}{35pt}
\setlength{\textwidth}{160mm}
\setlength{\evensidemargin}{0pt}
\setlength{\headheight}{12pt}

%Defining some fonts for the letter head...
\DeclareFixedFont{\xviisf}{OT1}{cmss}{m}{n}{17}
\DeclareFixedFont{\xsf}{OT1}{cmss}{m}{n}{10}
\DeclareFixedFont{\viiisf}{OT1}{cmss}{m}{n}{8}

%letterhead is two fields, total = 160 = textwidth
\newlength{\leftfield} \setlength{\leftfield}{117mm}
\newlength{\rightfield} \setlength{\rightfield}{43mm}

%put institute name in several "saved boxes"
\newsavebox{\FIRM}
\newsavebox{\firm}
\newsavebox{\firmaddress}
\newsavebox{\firmreturn}

\sbox{\FIRM}
    {\parbox[t]{\leftfield}
        {\xviisf MAX--PLANCK--INSTITUT FUR AERONOMIE}}

\sbox{\firm}
    {\xsf MAX--PLANK--INSTITUT FUR AERONOMIE}

\sbox{\firmreturn}
    {\viiisf\underline{MPI fur Aeronomie, \postcode{} Katenburg--Lindau}}

\sbox{\firmaddress}
    {\parbox[t]{\rightfield}{\viiisf\baselineskip10pt
    Max--Plank--Strasse 2\\
    \postcode{} Katlenburg--Lindau\\\germanname}}

%put together   
\newsavebox{\firmhead}  \newsavebox{\firmfoot}

\sbox{\firmhead}
    {\parbox{\textwidth}{\usebox{\FIRM}\raisebox{6pt}
        {\usebox{\firmaddress}}\\[3pt]  \rule{\textwidth}{1pt}}}

\sbox{\firmfoot}
            {\parbox{\textwidth}{\rule{\textwidth}{0.6pt}\\[5pt]
                \viiisf\setlength{\baselineskip}{12pt}%
            \begin{tabular}[t]{@{}ll}
                \underline{\telephonename} & \telcode-1\\
                \underline{Telefax} & \telcode-240\\
                \underline{Telex}       & 9\,65\,527 aerli
            \end{tabular}\hfill
            \begin{tabular}[t]{l}
                \underline{Bank}\\
                Kreis--Sparkasse Northeim\\
                41\,104\,449 (BLZ 262\,500\,01)
            \end{tabular}\hfill
            \begin{tabular}[t]{l@{}}
                \underline{\stationname}\\
                Northeim\\
                (Han.)
            \end{tabular} }}

%put head/foot boxes on first page
\renewcommand{\ps@firstpage}
    {\setlength{\headheight}{41pt}\setlength{\headsep}{25pt}%
        \renewcommand{\@oddhead}{\usebox{\firmhead}}%
        \renewcommand{\@oddfoot}{\raisebox{-20pt}[0pt]
                                        {\usebox{\firmfoot}}}%
        \renewcommand{\@evenhead}{}\renewcommand{\@evenfoot}{}}

%don't know
\renewcommand{\ps@headings}
    {\setlength{\headheight}{41pt}%
        \renewcommand{\@oddhead}
            {\parbox{\textwidth}{\usebox{\firm}\\[5pt]
                \slshape \headtoname{} \toname\hfill\@date\hfill
                                                            \pagename{} \thepage\\
                \rule[3pt]{\textwidth}{1pt}}}
        \renewcommand{\@oddfoot}{}
        \renewcommand{\@evenhead}{\oddhead}
        \renewcommand{\@evenfoot}{\@oddfoot}
}
%
\providecommand{\@evenhead}{}\providecommand{\@oddhead}{}
\providecommand{\@evenfoot}{}\providecommand{\@oddfoot}{}

%make headings the active page style
\pagestyle{headings}

%lastly, redefine opening cmd that prints address/salutation
\renewcommand{\opening}[1]{\thispagestyle{firstpage}%
    \parbox[t]{\leftfield}
        {\usebox{\firmreturn}\\
            \parbox[b][3.5cm][c]{\leftfield}{\toname\\\toaddress}}%
        \parbox[t]{\rightfield}
            {\fromname
                \ifthenelse{\equal{\telephonenum}{}}
                    {}{\\ Tel.: \telcode-\telephonenum}
                \ifthenelse{\equal{\@internet}{}}
                    {}{\\{\viiisf Email: \@internet\INTERNET}}
                \\[5mm] \@date}
            \par
            \rule{\textwidth}{0.6pt}
            \makebox[\leftfield][1]
                {\ifthenelse{\equal{\@yref}{}}
                    {\@ymail}{\@yref\hfill\@ymail\hfill}}
            \@myref\par
            \ifthenelse{\equal{\@subject}{}}
                {}{\@subject\par}
            \vspace{2\parskip} #1 \par\nobreak}

And my letter for that class

\documentclass[12pt]{mpletter}
\name{Dr P. W. Daly} 
\signature{Patrick W. Daly}
\myref{PWD/sib}
\date{May 10, 1998}
\subject{\LaTeX{} information}
\telephone{279} \internet{daily}
\ymail{April 28, 1998} \yref{FGM/sdf}
\begin{document}
\begin{letter}{%
Mr George Murphy\\35 Watervile Rd.\\
Centertown, New England\\USA}
\opening{Dear George,}
Thank you!
\closing{Regards,}
\encl{x}
\cc{H. Kopka}
\end{letter}
\end{document}
share|improve this question
    
You have \telcoede in \englishnames. But there are many more errors; for example, you don't define \Telefax and \Telex, but you're using them. –  egreg Feb 19 '13 at 0:38
1  
...moreover, your example uses \telephone(279}, not \telephone{279}... –  Werner Feb 19 '13 at 0:40
    
Right, I see the big mistake now. I left out a few lines. –  jhstuckey Feb 19 '13 at 0:44
    
You've left out some closing brace, check them. Besides, it's useless to have \DeclareOption without a \ProcessOptions declaration. –  egreg Feb 19 '13 at 0:51
    
\ProcessOptions is on line 11 of the mpletter.cls. –  jhstuckey Feb 19 '13 at 0:55
show 5 more comments

closed as off-topic by Joseph Wright Aug 8 '13 at 7:49

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.