为什么在编译此自定义字母类时收到未定义的控制序列错误?

为什么在编译此自定义字母类时收到未定义的控制序列错误?

我已经阅读了 Kopka & Daly 的书《LATEX 指南》第 3 版,并且正在尝试重新创建从第 305 页开始的示例自定义字母。

自定义字母类“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}

我写给那堂课的信

\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}

相关内容