Skip to content
This repository was archived by the owner on May 17, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/workflows/latex-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: LaTeX Build Check

on:
push:
paths:
- 'slide/**'
- 'note/**'
- 'scripts/**'
- '.github/workflows/latex-build.yml'
pull_request:
paths:
- 'slide/**'
- 'note/**'
- 'scripts/**'

jobs:
build-slide:
name: Build Slide (xelatex)
runs-on: ubuntu-latest
container:
image: texlive/texlive:latest
steps:
- uses: actions/checkout@v4

- name: Build slide
working-directory: slide
run: latexmk -xelatex -interaction=nonstopmode main.tex

- name: Check for errors
working-directory: slide
run: |
if grep -q "^!" build/main.log; then
echo "=== LaTeX Errors Found ==="
grep "^!" build/main.log
exit 1
fi

- name: Show result
working-directory: slide
run: |
grep "Output written" build/main.log
echo "Overfull vbox warnings: $(grep -c 'Overfull' build/main.log || echo 0)"

- name: Upload slide PDF
uses: actions/upload-artifact@v4
with:
name: slide
path: slide/build/main.pdf
retention-days: 7

build-note:
name: Build Note (xelatex)
runs-on: ubuntu-latest
container:
image: texlive/texlive:latest
steps:
- uses: actions/checkout@v4

- name: Build note
working-directory: note
run: latexmk -xelatex -interaction=nonstopmode main.tex

- name: Check for errors
working-directory: note
run: |
if grep -q "^!" build/main.log; then
echo "=== LaTeX Errors Found ==="
grep "^!" build/main.log
exit 1
fi

- name: Show result
working-directory: note
run: |
grep "Output written" build/main.log
echo "Overfull vbox warnings: $(grep -c 'Overfull' build/main.log || echo 0)"

- name: Upload note PDF
uses: actions/upload-artifact@v4
with:
name: note
path: note/build/main.pdf
retention-days: 7
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ build/
*.pdf

materials/
images/
products/

.opencode/
.sisyphus/

images/
.sisyphus/
55 changes: 31 additions & 24 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
# AGENTS.md — C语言期末模拟卷讲评讲座

LaTeX beamer 幻灯片项目(96页),ctexbeamer + metropolis 主题,xelatex 编译。克莱因蓝 (IKB) 配色
LaTeX beamer 幻灯片项目(95页),ctexbeamer + metropolis 主题,xelatex 编译。深蓝灰 + 亮蓝 accent + 暖琥珀色答案高亮配色

## 编译命令

```bash
latexmk -xelatex main.tex # 编译到 build/main.pdf
scripts\build.bat # 双击运行(带暂停)
pwsh scripts\build.ps1 # PowerShell 编译
scripts\clean.bat # 清理 build/
python scripts\gen_note.py # 从 PDF 生成发言稿 speaker_notes.txt
cd slide && latexmk -xelatex main.tex # 编译幻灯片 → slide/build/main.pdf → products/展示.pdf
cd note && latexmk -xelatex main.tex # 编译讲稿 → note/build/main.pdf → products/讲稿.pdf
scripts\build-all.bat # 一键构建 PPT + 讲稿,并输出到 products/
scripts\build-all.ps1 # PowerShell 一键构建
scripts\clean-all.bat # 清理所有构建产物
```

- **必须 xelatex**,不可 pdflatex(中文支持)
- `.latexmkrc` 配置 `$out_dir = 'build'`,`-interaction=nonstopmode`
- 构建产物(aux/log/out/toc/nav/snm/vrb 等)、`build/`、`*.pdf`、`materials/` 已加入 `.gitignore`
- 构建产物(aux/log/out/toc/nav/snm/vrb 等)、`build/`、`*.pdf`、`materials/`、`.idea/`、`.sisyphus/` 已加入 `.gitignore`

## 项目结构

```
main.tex — 入口:文档类 / 主题 / 配色 / \lstset / \input 所有 slide
.latexmkrc — latexmk 编译配置
slide/main.tex — 入口:文档类 / 主题 / 配色 / \lstset / \input 所有章节
slide/.latexmkrc — latexmk 编译配置(输出到 build/,即 slide/build/)
README.md — 人类可读项目说明(幻灯片索引、知识点映射)
slides/ — 10 个 .tex 片段(不完整文档,由 main.tex \input)
scripts/ — build.bat / build.ps1 / clean.bat / gen_note.py
slide/chapters/ — 幻灯片 LaTeX 片段(不完整文档,由 slide/main.tex \input)
note/ — 讲稿 LaTeX 文件 (note/main.tex + note/chapters/)
note/.latexmkrc — latexmk 编译配置(输出到 build/,即 note/build/)
scripts/ — build-all.bat / build.ps1 / clean-all.bat / gen_note.py
products/ — 最终输出 PDF(展示.pdf + 讲稿.pdf,gitignore)
.github/ — GitHub Actions CI(latex-build.yml)
materials/ — 原始试卷 PDF(gitignore)
figures/ — 图片资源
code/ — 示例 C 代码
images/ — 图片资源
```

## 配色方案

克莱因蓝 (International Klein Blue, RGB 0,47,167) 全蓝色系,定义在 `main.tex` 前言区:
深蓝灰 + 亮蓝 accent + 暖琥珀色答案高亮,定义在 `slide/main.tex` 前言区:

| 色名 | RGB | 用途 |
|------|-----|------|
| primary | (0,38,150) | frametitle, block 标题, 进度条 |
| accent | (0,55,180) | 项目符号, 结构元素, 代码关键词 |
| highlight | (0,90,210) | 答案标注(`\color{highlight}`) |
| accentlight | (222,234,254) | block 背景 |
| bglight / bglighter | (244,247,254) / (250,251,255) | block body / code 背景 |
| primary | (30,41,59) | frametitle, block 标题, 进度条 |
| accent | (59,130,246) | 项目符号, 结构元素, 代码关键词 |
| highlight | (217,119,6) | 答案标注(`\color{highlight}`),暖琥珀色 |
| accentlight | (219,234,254) | block 背景 |
| bglight / bglighter | (241,245,249) / (248,250,252) | block body / code 背景 |
Comment on lines 35 to +45

修改配色只需改 `main.tex` 中 `\definecolor` 和 `\setbeamercolor` 块,不要散落到各 slide 文件。
修改配色只需改 `slide/main.tex` 中 `\definecolor` 和 `\setbeamercolor` 块,不要散落到各 slide 文件。

## 幻灯片文件约定

Expand All @@ -63,27 +66,31 @@ code/ — 示例 C 代码
### 标准 frame 结构

```latex
\begin{frame}{题号标题}{知识点}
% --- 题目页 ---
\begin{frame}{题号标题}{知识点 --- 题目}
\begin{exampleblock}{题目}
题目内容...
\end{exampleblock}
\pause
\end{frame}

% --- 解析页 ---
\begin{frame}{题号标题}{知识点 --- 解析}
\begin{alertblock}{解析}
解析内容...
{\color{highlight}答案:X}
\end{alertblock}
\end{frame}
```

- `\pause` 分离题目/解析,逐页揭晓
- 题目与解析已拆分为独立 frame,不再使用 `\pause`
- 答案用 `{\color{highlight}...}` 突出
- 代码块 `lstlisting` (language=C)

### 内容溢出处理

当解析内容过多导致底部溢出时,按优先级处理:

1. **全局** `main.tex` 已设 `basicstyle=\footnotesize\ttfamily` + itemize `itemsep=0.08em`
1. **全局** `slide/main.tex` 已设 `basicstyle=\footnotesize\ttfamily` + itemize `itemsep=0.08em`
2. **局部** 对溢出 block 添加 `\small` 或 `\footnotesize`
3. **拆分** 将一帧拆为「题目」+「解析」两帧,标题加 `--- 题目` / `--- 解析` 后缀(如 Q9、Q16、Q20)
4. **极限** 仅代码帧可将 lstlisting 局部设为 `\scriptsize\ttfamily` 或 `\tiny\ttfamily`
Expand Down
70 changes: 44 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@

```
.
├── main.tex ← 入口文件:文档类 / 主题 / 配色 / \lstset / \input 所有 slide
├── .latexmkrc ← latexmk 编译配置(xelatex,输出到 build/)
├── .gitignore ← 忽略构建产物(*.aux, *.log, build/, *.pdf, materials/)
├── AGENTS.md ← AI Agent 项目说明
├── slide/
│ ├── main.tex ← 入口:文档类 / 主题 / 配色 / \lstset / \input 所有章节
│ ├── chapters/ ← 幻灯片片段文件(由 slide/main.tex \input 引入)
│ ├── .latexmkrc ← latexmk 编译配置(xelatex,输出到 build/)
│ └── build/ ← 编译输出(PDF 等)
├── .gitignore ← 忽略构建产物(*.aux, *.log, build/, *.pdf, materials/)
├── AGENTS.md ← AI Agent 项目说明
├── README.md
├── slides/ ← 幻灯片片段文件(由 main.tex \input 引入)
│ ├── 01-title.tex ← 标题页
│ ├── 02-outline.tex ← 目录 / 讲座大纲
│ ├── 10-choice-1.tex ← 选择题 第 1—10 题
Expand All @@ -29,19 +31,27 @@
│ ├── 50-programming.tex ← 编程题:电梯调度系统
│ └── 99-end.tex ← 结束页
Comment on lines 22 to 32
├── scripts/ ← 编译与辅助脚本
│ ├── build.bat ← Windows 批处理编译(带暂停)
│ ├── build.ps1 ← PowerShell 编译
│ ├── clean.bat ← 清理 build/ 目录
│ ├── build.bat ← Windows 批处理编译幻灯片
│ ├── build.ps1 ← PowerShell 编译幻灯片
│ ├── build-all.bat ← 一键构建 PPT + 讲稿
│ ├── clean.bat ← 清理幻灯片构建产物
│ ├── clean-all.bat ← 清理所有构建产物
│ └── gen_note.py ← 从 PDF 提取文本生成发言稿
├── materials/ ← 原始试卷 PDF(不纳入版本控制)
├── figures/ ← 图片资源
├── code/ ← 示例代码
└── build/ ← 编译产物目录(gitignore)
├── images/ ← 图片资源(Logo 等)
├── products/ ← 最终输出 PDF(展示.pdf + 讲稿.pdf,gitignore)
├── .github/ ← GitHub Actions CI
│ └── workflows/
│ └── latex-build.yml ← LaTeX 编译验证
├── note/ ← 讲稿 LaTeX 文件
│ ├── main.tex ← 讲稿入口
│ ├── .latexmkrc ← 讲稿编译配置
│ └── chapters/ ← 讲稿章节文件
```

## 幻灯片内容索引

### 选择题(一)— `slides/10-choice-1.tex`
### 选择题(一)— `slide/chapters/10-choice-1.tex`

| 题号 | 知识点 |
|------|--------|
Expand All @@ -56,7 +66,7 @@
| 9 | 字符数组声明(拆分为题目 + 解析两帧) |
| 10 | 二维数组下标越界 |

### 选择题(二)— `slides/11-choice-2.tex`
### 选择题(二)— `slide/chapters/11-choice-2.tex`

| 题号 | 知识点 |
|------|--------|
Expand All @@ -71,7 +81,7 @@
| 19 | 字符串指针数组 — 类型判断 |
| 20 | 字符串指针输出(拆分为题目 + 解析两帧) |

### 基本概念填空题 — `slides/20-basic-blank.tex`
### 基本概念填空题 — `slide/chapters/20-basic-blank.tex`

| 空号 | 知识点 |
|------|--------|
Expand All @@ -81,7 +91,7 @@
| 8 | 结构体初始化 |
| 9—10 | 逗号表达式 |

### 阅读程序填空题(一)— `slides/30-reading-1.tex`
### 阅读程序填空题(一)— `slide/chapters/30-reading-1.tex`

| 题号 | 知识点 |
|------|--------|
Expand All @@ -91,7 +101,7 @@
| 4 | 字符处理 |
| 5 | 递归函数(拆分为代码 + 解析两帧) |

### 阅读程序填空题(二)— `slides/31-reading-2.tex`
### 阅读程序填空题(二)— `slide/chapters/31-reading-2.tex`

| 题号 | 知识点 |
|------|--------|
Expand All @@ -101,15 +111,15 @@
| 9 | 数组奇偶处理(拆分为代码 + 解析两帧) |
| 10 | 异或交换(拆分为代码 + 解析两帧) |

### 程序完善题 — `slides/40-complete.tex`
### 程序完善题 — `slide/chapters/40-complete.tex`

| 题号 | 知识点 |
|------|--------|
| 1 | 字符类型判断(拆分为代码 + 答案两帧) |
| 2 | 数组查找(拆分为代码 + 答案两帧) |
| 3 | 统计非负数(拆分为代码 + 答案两帧) |

### 编程题 — `slides/50-programming.tex`
### 编程题 — `slide/chapters/50-programming.tex`

| 内容 | 说明 |
|------|------|
Expand All @@ -130,22 +140,30 @@
### 快速编译

```bash
# 方式一:latexmk(推荐)
latexmk -xelatex main.tex
# 完整构建 — 幻灯片 + 讲稿(推荐)
scripts\build-all.bat # Windows 批处理
pwsh scripts\build-all.ps1 # PowerShell

# 方式二:双击批处理
scripts\build.bat
# 仅幻灯片
scripts\build.bat # Windows 批处理
pwsh scripts\build.ps1 # PowerShell

# 方式三:PowerShell
pwsh scripts\build.ps1
# 命令行(单独编译)
cd slide && latexmk -xelatex main.tex # 仅幻灯片
cd note && latexmk -xelatex main.tex # 仅讲稿
```

编译成功后,PDF 输出至 `build/main.pdf`。
编译成功后:
- `slide/build/main.pdf` → 复制到 `products/展示.pdf`
- `note/build/main.pdf` → 复制到 `products/讲稿.pdf`

### 清理

```bash
# 删除 build/ 目录
# 清理所有构建产物
scripts\clean-all.bat

# 仅清理幻灯片
scripts\clean.bat
```

Expand Down
Empty file removed code/.gitkeep
Empty file.
File renamed without changes.
Loading
Loading