我正在尝试主要使用 enumerate 命令进行考试;但是,我一直收到错误。我尝试在问题前添加一个 \begin{enumerate} 和两个 \end{enumerates},这会产生输出,但列表从每个问题的开头开始:a、a、a、a 等等... 下面是我正在使用的 tex 和 cls。任何帮助都将不胜感激。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% SIIT Exam Class
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{siitexam}[2014/05/20 v1.0 SIIT Exam]
% Developed by Steven Gordon
% http://sandilands.info/sgordon/
% $Revision: 854 $
% $Date: 2010-12-02 18:26:52 +0700 (Thu, 02 Dec 2010) $
% $Author: sgordon $
% $URL: https://sandilands.info/svn/Common/Styles/siitassess/siitexam.cls $
% Use the article class
\LoadClass[12pt,onecolumn,twoside,a4paper]{article}
% Required packages
\RequirePackage{fancyhdr} % Needed for headers and footers
\RequirePackage{qvariants} % Needed for question variants
% Page layout (25mm margins around text)
\setlength{\hoffset}{-2mm}
\setlength{\voffset}{-12mm}
\setlength{\oddsidemargin}{0mm}
\setlength{\evensidemargin}{0mm}
\setlength{\topmargin}{0mm}
\setlength{\textheight}{246mm}
\setlength{\textwidth}{159mm}
\setlength{\marginparsep}{2mm}
\setlength{\marginparwidth}{20mm}
\setlength{\headheight}{6mm}
\setlength{\headsep}{6mm}
% Set the counters to appropriate format for questions and subquestions
\renewcommand{\thesection}{Section \arabic{section}}
\renewcommand{\labelenumi}{(\alph{enumi})}
\renewcommand{\labelenumii}{\roman{enumii}.}
% Question numbering
\newcommand{\question}[1]{\section{\textmd{[#1 points]}}}
\newcommand{\mcquestion}[1]{%
\renewcommand{\thesection}{Multiple Choice Questions}
\renewcommand{\labelenumi}{\arabic{enumi}.}
\renewcommand{\labelenumii}{(\alph{enumii})}
\section{\textmd{[#1 marks]}}}
% Exam instructions (to be edited in .tex file)
\newcommand{\examinstructions}[1]{}
% Document information
\newcommand{\docversion}[1]{\def\@docversion{#1}}
\newcommand{\docnumber}[1]{\def\@docnumber{#1}}
\newcommand{\docfile}[1]{\def\@docfile{#1}}
\newcommand{\docdate}[1]{\def\@docdate{#1}}
\newcommand{\instructor}[1]{\def\@instructor{#1}}
\newcommand{\exam}[1]{\def\@exam{#1}}
\newcommand{\coursecode}[1]{\def\@coursecode{#1}}
\newcommand{\coursetitle}[1]{\def\@coursetitle{#1}}
\newcommand{\courseshort}[1]{\def\@courseshort{#1}}
\newcommand{\semester}[1]{\def\@semester{#1}}
\newcommand{\academicyear}[1]{\def\@academicyear{#1}}
\newcommand{\testdate}[1]{\def\@testdate{#1}}
% Some commonly used phrases/names
\newcommand{\siit}{University of Missouri}
\newcommand{\tu}{St. Louis}
% Title page
\renewcommand{\maketitle}{%
% Header/footer for title page
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[LO,LE]{Name \ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots $\;$ Date: \ldots\ldots\ldots\ldots\ldots }
\fancyhead[RO,RE]{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
% The title page
\begin{center}
{\Large\textbf{\siit}}\\
\vspace*{2mm}
{\Large\textbf{\tu}}\\
\vspace*{5mm}
{\textbf{\@exam: Semester \@semester, \@academicyear}}\\
\end{center}
\begin{description}
\item[Course Title:] \@coursecode\ \@coursetitle
\item[Instructor:] \@instructor
\item[Date/Time:] \@testdate
\end{description}
\hrule
\paragraph{Instructions:}
\examinstructions
\newpage
% Header/foot for rest of document
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[LO,LE]{\itshape\footnotesize{\siit}}
\fancyhead[RO,RE]{\itshape\footnotesize{\@coursecode}}
\fancyfoot[LO,LE]{\itshape\footnotesize{\@courseshort}}
\fancyfoot[CO,CE]{\itshape\footnotesize{}}
\fancyfoot[RO,RE]{\itshape\footnotesize{\thepage}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
}
% Summary document information
documentclass{siitexam}
\usepackage{graphicx}
% If SVN is being used, uncomment the following \usepackage and \SVN lines
%\usepackage{svn}
%\usepackage{xstring}
%\SVN $Revision: 855 $
%\SVN $Author: sgordon $
%\SVN $Date: 2012-10-17 20:06:42 +0700 (Wed, 17 Oct 2012) $
%\SVN $URL: https://sandilands.info/svn/Common/Styles/siitassess/exam.tex $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Document Information
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% The variant determines if the answer ('ans') or question ('a') sheet is
%% produced as output. The variant selected ('ans' or 'a') will determine
%% the sheet output to the PDF when running latex. (Un)comment as necessary.
\renewcommand{\variant}{ans} % Answer sheet
%\renewcommand{\variant}{a} % Question sheet
% Set the title, author and course information
\coursecode{PS 1100}
\coursetitle{Introduction to American Government}
\courseshort{Introduction to American Government}
\instructor{John D'Attoma}
\semester{Fall}
\academicyear{2014}
% Set the exam title and date
\exam{Exam 1\ifthenelse{\equal{\variant}{ans}}{ Answers}{}}
\testdate{Wednesday, September 17, 2014}
% Set the document version and date
% If SVN is being used, uncomment the following 3 lines (and edit the URL)
%\docversion{\SVNRevision}
%\docdate{\SVNDate}
%\docfile{\StrBehind{\SVNURL}{https://sandilands.info/svn/}}
% Set the path to search for images/figures
\graphicspath{{../../Figures/out/}{../../Common/Figures/}}
\DeclareGraphicsExtensions{.pdf,.eps,.png}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Title Page
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Edit the exam instructions if necessary (especially number of pages)
\renewcommand{\examinstructions}{%
\begin{itemize}
\item Students are not allowed to be out of the exam room during examination. Going to the restroom may result in score deduction.
\item Turn off all communication devices (mobile phone etc.) and leave them at the front of the examination room.
\item Write your name and Date on the front page and on any separate sheets.
%\item The space on the back of each page can be used if necessary.
\item The examination paper is not allowed to be taken out of the examination room. A violation may result in score deduction.
\end{itemize}
\ifthenelse{\equal{\variant}{ans}}{}
}
\begin{document}
\maketitle
\clearpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\question{50}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
True False. Use your scantron sheets to fill in A for true and B for false. 1 point for a correct answer. 0 marks for an incorrect answer or no answer.
Multiple choice; Each question is worth 2 points each.
\begin{enumerate}
\item
A custom, practice, or organization, often embedded in rule of law, is called:
\begin{enumerate}
\item A policy
\item \qansmc{An institution}
\item A legal procedure
\item A rule
\end{enumerate}
\item The rule of an elite few for their own interests.
\begin{enumerate}
\item Monarchy
\item Polis
\item Democracy
\item \qansmc{Oligarchy}
\end{enumerate}
\item
A republic combines principles from monarchy, aristocracy, and democracy.
\begin{enumerate}
\item True
\item False
Answer: True
\end{enumerate}
\item Adam Smith and John Locke were British intellectuals that influenced American thought.
\begin{enumerate}
\item True
\item False
\textbf{Answer: True}
\end{enumerate}
\item The principles of equality and tolerance were central to early American social thinking because these principles were central to the doctrines of most of the major religious traditions in North America at the time.
\begin{enumerate}
\item True
\item False
\end{enumerate}
Answer: False
\结束{文档}
答案1
你缺少了
\end{enumerate}
在最后一个“Answer: False”和“\end{document}”之间。也就是说,文件应该以以下内容结束:
...
Answer: False
\end{enumerate}
\end{document}
此外,您在 documentclass 中缺少反斜杠 (\):
\documentclass{siitexam}
我将示例开头到 documentclass 行之前的所有内容复制到 中john.cls
,然后从 documentclass 行到结尾,加上我上面建议的修复,复制到 中,john.tex
编译成功。(当然我也有文件qvariants.sty
)。生成的两个页面如下: