LogoPaperX 文档

考研专业课真题模板 0.4

Postgraduate Entrance Exam Professional Course Past Papers Template v0.4

📖 目录 (Table of Contents)


中文文档

简介

本模板是一个专业的 LaTeX 考研真题试卷生成系统,适用于研究生入学考试专业课真题的排版与管理。

主要特点:

  • ✅ 模块化设计,支持多年份试卷批量生成
  • ✅ 统一管理试卷元数据(学校、科目、年份等)
  • ✅ 支持两个科目的试卷模板
  • ✅ 支持9种题型(单选、多选、填空、名词解释、判断、简答、论述、作图、计算、证明)
  • ✅ 自动生成目录、页眉、页脚、密封线
  • ✅ 支持学生版(无答案)和教师版(含答案)
  • ✅ 可自定义页面边框、二维码、联系方式等

目录结构

考研专业课真题模板/
├── main.tex                     # 主文件,编译入口
├── config.tex                   # 全局配置文件(页面样式、命令定义)
├── content.tex                  # 试卷元数据(学校、科目、年份、联系方式)
│
├── papers/                      # 试卷文件夹
│   ├── template.tex             # 试卷模板(复制此文件创建新试卷)
│   ├── 2004.tex                 # 2004年试卷
│   ├── 2005.tex                 # 2005年试卷
│   └── ...                      # 其他年份试卷
│
├── questions/                   # 题目文件夹
│   ├── q001.tex                 # 题目1(后端自动生成)
│   ├── q002.tex                 # 题目2
│   └── ...                      # 更多题目
│
├── images/                      # 图片素材文件夹
├── exam-zh.cls                  # LaTeX 文档类
├── exam-zh-*.sty                # LaTeX 样式包
├── build.bat                    # Windows 编译脚本
└── clean.bat                    # 清理临时文件脚本

快速开始

1. 环境要求

  • TeX 发行版:TeX Live / MiKTeX
  • 编译器:XeLaTeX(必须)
  • 编码:UTF-8

2. 编译试卷

方法一:使用脚本(Windows)

# 双击运行
build.bat

方法二:命令行编译

xelatex -interaction=nonstopmode main.tex
xelatex -interaction=nonstopmode main.tex  # 编译两次以生成目录

3. 修改试卷信息

content.tex 中修改以下内容:

% 学校名称
\newcommand{\CoverSchoolName}{成都理工大学}

% 考试科目
\newcommand{\CoverSubjectName}{土木工程}

% 考试代码
\newcommand{\CoverSubjectCode}{819}

% 微信公众号、联系方式等
\newcommand{\WechatPublicAccount}{人工石教育}

4. 添加新年份试卷

步骤 1: 复制 papers/template.tex 并重命名为 papers/2025.tex

步骤 2:content.tex\PaperList 中添加:

\newcommand{\PaperList}{
    \AddPaper{二〇〇四年}{2004}
    \AddPaper{二〇二五年}{2025}  % 新增
}

步骤 3: 重新编译 main.tex


配置说明

content.tex - 试卷元数据

| 命令 | 说明 | 示例 | |------|------|------| | \CoverSchoolName | 封面学校名称 | 成都理工大学 | | \CoverSubjectName | 封面科目名称 | 土木工程 | | \CoverSubjectCode | 科目代码 | 819 | | \ContentYear | 年份(中文) | 二〇二五年 | | \ExamTitle | 试卷标题 | 攻读硕士学位研究生入学考试试题 | | \WechatPublicAccount | 微信公众号 | 人工石教育 | | \QRCodeBilibili | B站二维码路径 | G:/path/to/qrcode.png |

config.tex - 全局样式配置

% 显示/隐藏答案
question/show-answer=false,  % false=学生版, true=教师版

% 页面边框
\ShowPageFrametrue           % true=显示边框, false=隐藏边框

% 页面设置
page/size=a4paper,           % a4paper / a3paper
page/show-head=true,         % 显示页眉

使用指南

在试卷中添加题目

编辑 papers/XXXX.tex,取消注释需要的题型:

% ====== 科目一 ======
\centering{\Large\textbf{《科目一》}}\\

\setcounter{section}{0}

% 单选题
\section{单选题:在每小题给出的四个选项中,只有一项是符合题目要求的。(共5题,每题2分,共10分)}
\examsetup{question/index=1,solution/blank-type=none}

% 在此处引入题目文件
\input{questions/q001}
\input{questions/q002}
% ...

% 简答题
\section{简答题:解答应写出文字说明、证明过程或者演算步骤。(共3题,每题10分,共30分)}
\examsetup{question/index=1,solution/label-content=答:}

\input{questions/q020}
% ...

题型配置说明

每种题型都有对应的 \examsetup 配置:

| 题型 | solution/label-content | solution/blank-type | |------|-------------------------|----------------------| | 单选题 | 无 | none | | 多选题 | 无 | none | | 填空题 | 无 | none | | 名词解释 | 答: | none | | 判断题 | 改: | none | | 简答题 | 答: | 默认 | | 论述题 | 答: | 默认 | | 作图题 | 答: | 默认 | | 计算题 | 解: | false | | 证明题 | 证: | 默认 |


English Documentation

Introduction

This is a professional LaTeX template system for Postgraduate Entrance Exam Professional Course Past Papers generation and management in China.

Key Features:

  • ✅ Modular design supporting multi-year batch generation
  • ✅ Unified metadata management (school, subject, year, etc.)
  • ✅ Support for two-subject exam papers
  • ✅ Support for 9 question types (single-choice, multiple-choice, fill-in-the-blank, terminology, true/false, short-answer, essay, drawing, calculation, proof)
  • ✅ Auto-generation of table of contents, headers, footers, seal lines
  • ✅ Student version (without answers) and teacher version (with answers)
  • ✅ Customizable page borders, QR codes, contact information

Directory Structure

考研专业课真题模板0.4/
├── main.tex                     # Main entry file for compilation
├── config.tex                   # Global configuration (page styles, command definitions)
├── content.tex                  # Paper metadata (school, subject, year, contacts)
│
├── papers/                      # Papers folder
│   ├── template.tex             # Paper template (copy to create new papers)
│   ├── 2004.tex                 # 2004 paper
│   ├── 2005.tex                 # 2005 paper
│   └── ...                      # Other years
│
├── questions/                   # Questions folder
│   ├── q001.tex                 # Question 1 (auto-generated by backend)
│   ├── q002.tex                 # Question 2
│   └── ...                      # More questions
│
├── images/                      # Image assets
├── exam-zh.cls                  # LaTeX document class
├── exam-zh-*.sty                # LaTeX style packages
├── build.bat                    # Windows build script
└── clean.bat                    # Clean temporary files script

Quick Start

1. Requirements

  • TeX Distribution: TeX Live / MiKTeX
  • Compiler: XeLaTeX (required)
  • Encoding: UTF-8

2. Compile Papers

Method 1: Using Script (Windows)

# Double-click to run
build.bat

Method 2: Command Line

xelatex -interaction=nonstopmode main.tex
xelatex -interaction=nonstopmode main.tex  # Compile twice for TOC

Configuration

content.tex - Paper Metadata

This file contains all user-customizable information that will be injected into the paper from the frontend:

% Cover Information
\newcommand{\CoverSchoolName}{成都理工大学}          % School name
\newcommand{\CoverSubjectName}{土木工程}             % Subject name
\newcommand{\CoverSubjectCode}{819}                  % Subject code

% Content Page Information
\newcommand{\ContentYear}{二〇〇四年}                % Year (Chinese)
\newcommand{\ContentSchoolName}{成都理工大学}        % School (inner page)
\newcommand{\ContentSubjectName}{土木工程}           % Subject (inner page)
\newcommand{\ContentSubjectCode}{819}                % Code (inner page)

% Title and Contact Information
\newcommand{\ExamTitle}{攻读硕士学位研究生入学考试试题}  % Exam title
\newcommand{\WechatPublicAccount}{人工石教育}        % WeChat public account
\newcommand{\WechatSupport}{your-support-wechat}             % WeChat support
\newcommand{\QQSupport}{your-support-qq}                  % QQ support
\newcommand{\AuthorName}{咖喱gaygay}                 % Author/compiler name

% QR Code Paths
\newcommand{\QRCodeBilibili}{G:/path/to/bilibili.png}
\newcommand{\QRCodeWechat}{G:/path/to/wechat.png}
\newcommand{\QRCodePersonal}{G:/path/to/personal.png}

% Paper List
\newcommand{\PaperList}{
    \AddPaper{二〇〇四年}{2004}
    \AddPaper{二〇〇五年}{2005}
    % Add more papers here
}

Technical Workflow

For Backend Integration

1. Questions Management (questions/ folder)

  • Each question is stored as a single .tex file
  • Naming convention: q001.tex, q002.tex, etc.
  • Backend should place individual question files in this folder
  • Question files contain only the question content (using \qitem, \begin{solution}, etc.)

Example question file structure (questions/q001.tex):

\qitem 题目内容...
\begin{choices}
    \item A选项
    \item B选项
    \item C选项
    \item D选项
\end{choices}
\begin{solution}
A
\end{solution}

2. Paper Generation (papers/ folder)

  • Use papers/template.tex as the base template
  • For each year, create a new file (e.g., papers/2025.tex) by copying template.tex
  • Uncomment relevant question type sections
  • Use \input{questions/qXXX} to include individual questions

3. Content Injection (content.tex)

  • Frontend collects user input (school name, subject, year, contact info, QR codes)
  • Backend generates/updates content.tex with user data
  • All custom commands are defined here for easy data injection

4. Build Process

The build pipeline should:

  1. Receive user input from frontend
  2. Generate/update content.tex with metadata
  3. Place question .tex files in questions/ folder
  4. Create year-specific paper file in papers/ folder based on template.tex
  5. Add paper to \PaperList in content.tex
  6. Run XeLaTeX compilation twice: xelatex -interaction=nonstopmode main.tex
  7. Output: main.pdf (student version) or main-答案.pdf (teacher version)

Question Type Configuration

Each question type requires specific \examsetup configuration:

| Type | Section Header | examsetup Configuration | |------|----------------|---------------------------| | Single Choice | 单选题 | question/index=1,solution/blank-type=none | | Multiple Choice | 多选题 | question/index=1,solution/blank-type=none | | Fill-in-blank | 填空题 | question/index=1,solution/blank-type=none | | Terminology | 名词解释 | question/index=1,solution/label-content=答:,solution/blank-type=none | | True/False | 判断题 | question/index=1,paren/type=hfill,solution/label-content=改:,solution/blank-type=none | | Short Answer | 简答题 | question/index=1,solution/label-content=答: | | Essay | 论述题 | question/index=1,solution/label-content=答: | | Drawing | 作图题 | question/index=1,solution/label-content=答: | | Calculation | 计算题 | question/index=1,solution/label-content=解:,solution/parbreak=false | | Proof | 证明题 | question/index=1,solution/label-content=证: |


API Workflow (For AI/Backend)

sequenceDiagram
    participant Frontend
    participant Backend
    participant FileSystem
    participant LaTeX

    Frontend->>Backend: Submit paper metadata + questions
    Backend->>FileSystem: Generate content.tex with metadata
    Backend->>FileSystem: Place question files in questions/
    Backend->>FileSystem: Create year paper in papers/YYYY.tex
    Backend->>FileSystem: Update \PaperList in content.tex
    Backend->>LaTeX: Run xelatex main.tex (x2)
    LaTeX->>Backend: Output main.pdf
    Backend->>Frontend: Return PDF download link

Example: Creating a New Paper (2025)

Step 1: Frontend receives user input

{
  "school": "清华大学",
  "subject": "计算机科学",
  "code": "408",
  "year": "二〇二五年",
  "questions": ["q050", "q051", "q052"]
}

Step 2: Backend generates content.tex

\newcommand{\CoverSchoolName}{清华大学}
\newcommand{\CoverSubjectName}{计算机科学}
\newcommand{\CoverSubjectCode}{408}
% ... other metadata

Step 3: Backend creates papers/2025.tex

\\
\centering{\Large\textbf{《科目一》}}\\

\setcounter{section}{0}
\section{单选题:(共3题,每题5分,共15分)}
\examsetup{question/index=1,solution/blank-type=none}

\input{questions/q050}
\input{questions/q051}
\input{questions/q052}

Step 4: Backend updates \PaperList

\newcommand{\PaperList}{
    \AddPaper{二〇〇四年}{2004}
    \AddPaper{二〇二五年}{2025}  % New entry
}

Step 5: Compile and deliver

xelatex -interaction=nonstopmode main.tex
xelatex -interaction=nonstopmode main.tex
# Output: main.pdf

📝 Notes

For Users

  • 始终使用 XeLaTeX 编译,不支持 pdfLaTeX
  • 修改试卷信息只需编辑 content.tex
  • 添加新年份试卷复制 template.tex 即可
  • 题型模板已预定义,取消注释即可使用

For AI/Backend

  • questions/ folder: One question per .tex file
  • papers/ folder: One paper per year, created from template.tex
  • content.tex: All user-customizable metadata (injected from frontend)
  • Compilation: Run XeLaTeX twice to generate complete PDF with TOC
  • Output: main.pdf (student) or main-答案.pdf (teacher)

🔧 Troubleshooting

| Problem | Solution | |---------|----------| | 编译失败 | 确认使用 XeLaTeX,检查 UTF-8 编码 | | 目录未显示 | 编译两次 xelatex main.tex | | 图片不显示 | 检查 content.tex 中的图片路径是否正确 | | 页眉页脚错误 | 检查 config.tex 中的路径配置 |


📄 License

本模板基于 exam-zh 文档类开发,遵循相应开源协议。


📧 Contact

  • 微信公众号: 人工石教育
  • 作者: 咖喱gaygay