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 文件 建立練習單和考試

