% !TeX root = ../exam-zh-doc-basic.tex \section{完整示例} 本章提供可直接使用的完整试卷示例。所有示例代码都可以在 \file{examples-basic/} 目录中找到。 \subsection{示例文件说明} \begin{description} \item[\file{00-minimal.tex}] 最小示例(10行代码创建试卷) \item[\file{01-first-exam.tex}] 第一份完整试卷(包含选择题、填空题、解答题) \item[\file{02-math-basic.tex}] 高中数学期末考试(带草稿纸) \item[\file{03-real-exam-scenario.tex}] 真实考试场景(带密封线、完整答案、评分标准) \end{description} \begin{tcolorbox}[colback=blue!5!white, colframe=blue!75!black, title=\textbf{如何使用这些示例}] \textbf{方法一:直接编译} \begin{enumerate} \item 进入 \file{examples-basic/} 目录 \item 选择一个示例文件,如 \file{01-first-exam.tex} \item 使用 XeLaTeX 编译:\texttt{xelatex 01-first-exam.tex} \item 查看生成的 PDF 文件 \end{enumerate} \textbf{方法二:复制修改} \begin{enumerate} \item 复制示例文件到你的工作目录 \item 修改标题、科目、题目内容 \item 注释或取消注释 |\examsetup| 切换学生版/教师版 \item 编译生成你自己的试卷 \end{enumerate} \textbf{推荐:}从 \file{01-first-exam.tex} 开始,这是最适合新手的模板。 \end{tcolorbox} \subsection{示例对比} \begin{center} \begin{tabular}{lp{5cm}p{5cm}} \hline \textbf{示例} & \textbf{特点} & \textbf{适用场景} \\ \hline 00-minimal & 最简代码,无答案控制 & 快速测试、学习基础语法 \\ 01-first-exam & 完整结构,有答案控制 & 日常测验、课堂小考 \\ 02-math-basic & 带草稿纸,题目较多 & 期中/期末考试 \\ 03-real-exam & 带密封线、评分标准 & 正式考试、月考 \\ \hline \end{tabular} \end{center} \subsection{数学试卷示例} 完整代码见 \file{examples-basic/01-first-exam.tex},这里展示主要结构: \begin{latexcode}[deletetexcs={\documentclass},morekeywords={\documentclass}] \documentclass{exam-zh} % 教师版配置(注释掉生成学生版) % \examsetup{ % question/show-answer = true, % solution/show-solution = show-stay % } \begin{document} % 试卷抬头 \title{2024年春季期中考试} \subject{数学} \maketitle \information{ 姓名\underline{\hspace{6em}}, 班级\underline{\hspace{6em}}, 座号\underline{\hspace{4em}} } \begin{notice} \item 本试卷共3大题,满分100分,考试时间90分钟。 \item 请用黑色签字笔在答题卡上作答。 \end{notice} % 一、选择题 \section{选择题(每题5分,共20分)} \begin{question} 已知集合 $A = \{1, 2, 3\}$,$B = \{2, 3, 4\}$, 则 $A \cap B = $ \paren[B] \begin{choices} \item $\{1\}$ \item $\{2, 3\}$ % 正确答案 \item $\{1, 2, 3, 4\}$ \item $\varnothing$ \end{choices} \end{question} % 二、填空题 \section{填空题(每题5分,共20分)} \examsetup{question/index = 0} % 重置题号 \begin{question} 若 $f(x) = 3x - 2$,则 $f(2) = $ \fillin[4]。 \end{question} % 三、解答题 \section{解答题(共60分)} \examsetup{question/index = 0} \begin{problem}[points = 15] 已知函数 $f(x) = x^2 - 4x + 3$。 \begin{enumerate} \item 求 $f(x)$ 的对称轴; \item 求 $f(x)$ 的最小值。 \end{enumerate} \begin{solution} \begin{enumerate} \item 对称轴为 $x = 2$。\score{7} \item 最小值为 $-1$。\score{8} \end{enumerate} \end{solution} \end{problem} \end{document} \end{latexcode} \subsection{真实考试场景示例} 完整代码见 \file{examples-basic/03-real-exam-scenario.tex},展示了真实考试的完整要素: \textbf{特色功能:} \begin{enumerate} \item \textbf{密封线:}使用 |\secret| 命令生成左侧密封线 \item \textbf{详细注意事项:}符合正式考试要求的考生须知 \item \textbf{完整评分标准:}每个给分点都用 |\score{分值}| 标记 \end{enumerate} \textbf{代码片段:} \begin{latexcode} % 密封线 \secret % 试卷信息 \information{ 姓名\underline{\hspace{6em}}, 班级\underline{\hspace{6em}}, 学号\underline{\hspace{6em}}, 考场\underline{\hspace{4em}}, 座号\underline{\hspace{3em}} } % 详细注意事项 \begin{notice} \item 本试卷共 4 页,22 小题,满分 150 分。 \item 答卷前,考生务必将自己的姓名、学号填写在答题卡上。 \item 作答选择题时,选出答案后,用2B铅笔在答题卡上涂黑。 \item 非选择题必须用黑色字迹的钢笔或签字笔作答。 \end{notice} % ... 题目内容 ... \end{latexcode} \subsection{自定义你的试卷} 基于这些示例,你可以轻松自定义: \begin{enumerate} \item \textbf{修改标题和科目} \begin{latexcode} \title{你的考试名称} \subject{你的科目} \end{latexcode} \item \textbf{调整题型分值} \begin{latexcode} \section{选择题(每题5分,共40分)} % 或 \section{选择题(本题共8小题,每小题5分,共40分)} \end{latexcode} \item \textbf{添加或删除题目} 直接复制 |question|、|problem| 环境块,修改内容即可 \item \textbf{切换学生版/教师版} 注释或取消注释文档开头的 |\examsetup| 配置 \end{enumerate} \subsection{更多示例} \textbf{官方仓库:} \begin{itemize} \item GitHub: \url{https://github.com/xkwxdyy/exam-zh} \item 查看 \file{examples-basic/} 目录获取最新示例 \item 查看 \file{example-single.tex} 获取高考真题示例 \end{itemize} \textbf{社区贡献:} \begin{itemize} \item 加入 QQ 交流群:652500180 \item 分享你的试卷模板 \item 获取更多使用技巧 \end{itemize} \begin{question} ... \end{question} % 三、解答题(4道) \section{解答题(共40分)} \examsetup{question/index = 0} \begin{problem}[points = 10] ... \begin{solution} ... \end{solution} \end{problem} \end{document} \end{latexcode} \subsection{使用建议} \subsubsection{如何使用示例} \begin{enumerate} \item \textbf{复制示例文件}: \begin{itemize} \item 找到最接近你需求的示例 \item 复制整个文件 \item 重命名为你的试卷名称 \end{itemize} \item \textbf{修改内容}: \begin{itemize} \item 修改标题和科目 \item 替换题目内容 \item 调整题目数量和分值 \end{itemize} \item \textbf{生成PDF}: \begin{itemize} \item 使用 XeLaTeX 编译 \item 检查效果 \item 根据需要调整 \end{itemize} \end{enumerate} \subsubsection{常见修改} \textbf{修改题目数量:} 直接增加或删除 |question|/|problem| 环境即可。 \textbf{修改分值分配:} 修改每题的 |[points = ...]| 参数,并调整标题中的总分。 \textbf{切换学生版/教师版:} 注释或取消注释文档开头的 |\examsetup| 配置。 \textbf{调整页面布局:} 参考第4章"常见场景"的页面设置部分。 \subsection{代码模板} 这里提供一些常用的代码片段,可以直接复制使用。 \subsubsection{选择题模板} \begin{latexcode} \begin{question} 题干内容 \paren[A] \begin{choices} \item 选项A(正确答案) \item 选项B \item 选项C \item 选项D \end{choices} \end{question} \end{latexcode} \subsubsection{填空题模板} \begin{latexcode} \begin{question} 题干内容,答案是 \fillin[答案] 。 \end{question} \end{latexcode} \subsubsection{解答题模板} \begin{latexcode} \begin{problem}[points = 10] 题干内容 \begin{solution} 解: 步骤1 \score{3} 步骤2 \score{4} 答案 \score{3} \end{solution} \end{problem} \end{latexcode} \subsection{进一步学习} \begin{itemize} \item 尝试修改示例文件,理解各部分的作用 \item 参考第3章学习更多题型和功能 \item 遇到问题查阅第6章FAQ \item 需要高级功能时查阅完整文档 \file{exam-zh-doc.pdf} \end{itemize}