LaTeX/教师园地
外观
< LaTeX
LaTeX 具有专门针对教师的功能。我们介绍了 exam 类[1],它非常适合设计带有答案的考试和练习。有兴趣的人也可以看看 probsoln 包[2]、mathexm 文档类[3] 或者 exsheets 包[4]。
我们介绍 exam 类。exam 类非常适合设计带有答案的考试。你只需要在前言中指定是否要打印答案。你也可以统计分数。
在前言中,你可以指定以下几行
\documentclass[a4paper,11pt]{exam}
\printanswers % If you want to print answers
% \noprintanswers % If you don't want to print answers
\addpoints % if you want to count the points
% \noaddpoints % if you don't want to count the points
% Specifies the way question are displayed:
\qformat{\textbf{Question\thequestion}\quad(\thepoints)\hfill}
\usepackage{color} % defines a new color
\definecolor{SolutionColor}{rgb}{0.8,0.9,1} % light blue
\shadedsolutions % defines the style of the solution environment
% \framedsolutions % defines the style of the solution environment
% Defines the title of the solution environment:
\renewcommand{\solutiontitle}{\noindent\textbf{Solution:}\par\noindent}
|
你可以用以下几行替换前三行
\documentclass[a4paper,11pt,answers,addpoints]{exam}
|
- 考试包含在 questions 环境中。
- 命令 \question 引入一个新的问题。
- 分数在方括号中指定。
- 答案在 solution 环境中给出。它只在前言中指定了 \printanswers 或 answers 作为 \documentclass 的选项时才会出现。
下面是一个示例
\begin{questions} % Begins the questions environment
\question[2] What is the solution? % Introduces a new question which is worth 2 points
\begin{solution}
Here is the solution
\end{solution}
\question[5] What is your opinion?
\begin{solution}
This is my opinion
\end{solution}
\end{questions}
也可以使用 \ifprintanswers 命令添加只有在答案打印时才会显示的内容。
\ifprintanswers
Only if answers are printed
\else
Only if answers are not printed
\fi
宏 \numquestions 给出问题的总数。宏 \numpoints 给出分数的总数。
\begin{minipage}{.8\textwidth}
This exam includes \numquestions\ questions. The total number of points is \numpoints.
\end{minipage}
\numquestion 后面的反斜杠阻止宏像往常一样吞噬后面的空格。
exsheets
包是 exam 类的替代方案。它可以用来创建试卷、包含答案的课本等。很多选项可以用来调整输出风格。以下是一个演示示例。
\documentclass{article}
\usepackage{booktabs}
\usepackage{exsheets}
\usepackage{tasks}
\SetupExSheets[question]{type=exam}
\SetupExSheets{
counter-format=se.qu,
counter-within=section,
headings=runin,
}
\begin{document}
\section{Chemistry}
\begin{question}{2}
Which one of the entries does not fit with the others?
\begin{tasks}(4)
\task mercury
\task iron
\task lead
\task zinc
\end{tasks}
\end{question}
\begin{question}{4}
Explain your decision for the answer above.
\blank[width=5\linewidth,linespread=1.5]{}
\end{question}
\section{Physics}
\settasks{
counter-format=(tsk[r]),
label-width=4ex
}
\begin{question}{1}
What is a funkyton?
\begin{tasks}(2)
\task A dancing electron
\task A dancing proton
\task A dancing neutron
\task A Dixie Dancing Duck
\end{tasks}
\end{question}
\begin{center}
\begin{tabular}{l*{\numberofquestions}{c}c}\toprule
Question & \ForEachQuestion{\QuestionNumber{#1}\iflastquestion{}{&} } & Total \\ \midrule
Points & \ForEachQuestion{\GetQuestionProperty{points}{#1}\iflastquestion{}{&} } & \pointssum* \\
Reached & \ForEachQuestion{\iflastquestion{}{&} } & \\ \bottomrule
\end{tabular}
\end{center}
\end{document}
exsheets
的后续版本将是 xsim
包。
- ↑ examdoc 使用 exam 文档类
- ↑ Probsoln 创建带有可选答案的问题单
- ↑ mathexm 文档
- ↑ exsheets 文档 创建练习单和考试