\maketitle 错误 - 控制序列未定义

\maketitle 错误 - 控制序列未定义

.tex我从一位同事那里继承了一份文档.cls,其中包含用于准备课程大纲的支持文件。提供该文件的人告诉我,他们运行它没有问题。但是,当我下载所有必要的文件并按下编译时,我看到了“未定义的控制序列。\maketitle”错误。我查看了该.cls文件以查看是否有任何明显的问题,但我找不到错误的来源。以下是源代码的一个最小工作示例:

% This is an example temple for the courseoutline.cls by Norm Gall
%
% I have used every new macro and environment.
%
% If you have tutorials, add ta to the options field in \documentclass
%
% Please read the .cls for any further explanations.
%
\documentclass[11pt]{courseoutline}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{color}
%
\university{No Name University}
\department{blah blah}
%
\coursename{Water and Landscapes}
\coursenumber{blah blah}
\coursesection{(sec. 101)}
\coursesession{Fall 2017-18}
\coursetime{Mo--We--Fr 10.00--11.00hrs}
\courselocation{blah blah}
\coursewebpage{blah blah}
%
\instructor{blah blah}
\instructoroffice{rm. 127, Geography}
\instructorofficehours{We--Fr 11.00--12.00hrs}
\instructorphone{(604) 822--9105}
\instructoremail{blah blah}
%
\ta{blah blah}
\taoffice{blah blah}
\taofficehours{available during scheduled labs}
%
\tutorialtime{
    \begin{tabular}[t]{l}
        (D) Tu 10.00--11.00hrs\\
        (E) Tu 13.00--14.00hrs\\
        (F) Tu 14.00--15.00hrs\\
        (G) We 12.00--13.00hrs\\
        (H) We 13.00--14.00hrs\\
        (I) Th 11.00--12.00hrs\\
        (J) Th 12.00--13.00hrs
    \end{tabular}
}
\tutoriallocation{
    \begin{tabular}[t]{r}
        rm 130\\
        rm 130\\
        rm 130\\
        rm 130\\
        rm 130\\
        rm 130\\
        rm 130\\
    \end{tabular}
}
\pagestyle{myheadings}
\markright{Water and Landscapes}
\begin{document}
\maketitle
\begin{textbooks}
    \begin{itemize}

    \item Bierman and Montgomery, 2013. \textit{Key Concepts in Geomorphology} (ISBN-10: 1-4292-3860-7). MacMillan.
    %\newline 
    \texttt{PLEASE NOTE: this textbook is MANDATORY, and is not equivalent to any previously used textbooks for this course}.

    \end{itemize}
\end{textbooks}
\end{document}

.cls文件定义\university\department等。

以下是文件中的定义块.cls

% - Main Code ------------------------------------------
%
%     some definitions 
%
\def\university#1{\gdef\@university{#1}}
\def\department#1{\gdef\@department{#1}}
\def\coursename#1{\gdef\@coursename{#1}}
\def\coursenumber#1{\gdef\@coursenumber{#1}}
\def\coursesection#1{\gdef\@coursesection{#1}}
\def\coursesession#1{\gdef\@coursesession{Session: #1}}
\def\coursetime#1{\gdef\@coursetime{Lecture Times: #1}}
\def\courselocation#1{\gdef\@courselocation{Room: #1}}
\def\coursewebpage#1{\gdef\@coursewebpage{website: #1}}
\def\texts#1{\gdef\@texts{#1}}
\def\instructor#1{\gdef\@instructor{Instructor: #1}}
\def\instructoroffice#1{\gdef\@instructoroffice{#1}}
\def\instructorofficehours#1{\gdef\@instructorofficehours{#1}}
\def\instructorphone#1{\gdef\@instructorphone{Office Phone: #1}}
\def\instructoremail#1{\gdef\@instructoremail{E-mail: #1}}
\def\ta#1{\gdef\@ta{Teaching Assistant: #1}}
\def\taoffice#1{\gdef\@taoffice{Office: #1}}
\def\taofficehours#1{\gdef\@taofficehours{Office Hours: #1}}
\def\taphone#1{\gdef\@taphone{Office Phone: #1}}
\def\taemail#1{\gdef\@taemail{E-mail: #1}}
\def\tutorialtime#1{\gdef\@tutorialtime{#1}}
\def\tutoriallocation#1{\gdef\@tutoriallocation{#1}}
%
\def\@ifdefined#1#2{\@ifundefined{#1}{}{#2}}

我的问题是,我似乎无法弄清楚为什么编译器会抛出“未定义的控制序列。\maketitle”错误。我查看了许多具有类似主题标题的帖子,但尝试了几种建议的修复方法都没有帮助。谢谢。更新:如果有助于解决问题,可以从此处下载该.tex文件和文件:.cls

https://www.dropbox.com/sh/n86yao7ejpbz800/AABdQXHRNqC0WfxuOER2tozqa?dl=0

该代码确实创建了一个 .pdf,看起来不错,但如果知道问题的根源就更好了。

答案1

\maketitle是从通常\maketitle由加载的类给出的重新定义的article,最后\@maketitle由重新定义的宏courseoutline.cls——\@maketitle需要使用各种命令来设置大量信息。

这里编译失败是因为\@taemail\@taphone尚未定义,同样,标准类也会失败,因为\title尚未使用。

% This is an example temple for the courseoutline.cls by Norm Gall
%
% I have used every new macro and environment.
%
% If you have tutorials, add ta to the options field in \documentclass
%
% Please read the .cls for any further explanations.
%
\documentclass[11pt]{courseoutline}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{color}
%
\university{No Name University}
\department{blah blah}
%
\coursename{Water and Landscapes}
\coursenumber{blah blah}
\coursesection{(sec. 101)}
\coursesession{Fall 2017-18}
\coursetime{Mo--We--Fr 10.00--11.00hrs}
\courselocation{blah blah}
\coursewebpage{blah blah}
%
\instructor{blah blah}
\instructoroffice{rm. 127, Geography}
\instructorofficehours{We--Fr 11.00--12.00hrs}
\instructorphone{(604) 822--9105}
\instructoremail{blah blah}
%
\ta{blah blah}
\taoffice{blah blah}
\taofficehours{available during scheduled labs}
\taemail{[email protected]}
\taphone{Foo}
%
\tutorialtime{
    \begin{tabular}[t]{l}
        (D) Tu 10.00--11.00hrs\\
        (E) Tu 13.00--14.00hrs\\
        (F) Tu 14.00--15.00hrs\\
        (G) We 12.00--13.00hrs\\
        (H) We 13.00--14.00hrs\\
        (I) Th 11.00--12.00hrs\\
        (J) Th 12.00--13.00hrs
    \end{tabular}
}
\tutoriallocation{
    \begin{tabular}[t]{r}
        rm 130\\
        rm 130\\
        rm 130\\
        rm 130\\
        rm 130\\
        rm 130\\
        rm 130\\
    \end{tabular}
}
\pagestyle{myheadings}
\markright{Water and Landscapes}
\begin{document}
\maketitle
\begin{textbooks}
    \begin{itemize}

        \item Bierman and Montgomery, 2013. \textit{Key Concepts in Geomorphology} (ISBN-10: 1-4292-3860-7). MacMillan.
        %\newline 
        \texttt{PLEASE NOTE: this textbook is MANDATORY, and is not equivalent to any previously used textbooks for this course}.

    \end{itemize}
\end{textbooks}
\end{document}

在此处输入图片描述

相关内容