5 Commits
Author SHA1 Message Date
laoyang 22aef7f995 修复金字塔组件:画出来是平行四边形,改为真正的梯形金字塔
问题(用户反馈):\flatpyramid 显示成「平行四边形」而不是梯形。

根因:tikz 的 trapezium 形状在给定 minimum width 时,会同时把上边和下边
撑到同一宽度,整体只是平移 —— 于是上下边等宽,就是一个平行四边形。
实测顶层顶点:上边宽 60.2pt、下边宽 60.2pt(完全相等)。

修复:不再使用 trapezium 形状,改为按显式坐标自绘梯形。
每一层的上边宽 = 上一层下边宽(斜边连续),各层中心对齐。
实测修复后(TeX Live 2025):
  层   上边宽   下边宽
  ①    42.5     78.7
  ②    78.7    114.8
  ③   114.8    150.9
  ④   150.9    187.1
形状参数已提到代码顶部并加注释(\flpw 顶半宽 / \flbw 底半宽 / \fllyh 层高),
需要调整金字塔胖瘦或高矮时改这三个值即可。

已验证:TeX Live 2025 下 0 错误 0 溢出;跨版本渲染逐像素一致。
2026-10-13 15:33:21 +08:00
laoyang a9aa741b62 同步「扁平简约图示组件」到本分支,并在 TeX Live 2025 下重新编译
内容与 main 一致(详见 main 上的提交说明):
- theme/beamerinnerthemeOUCSlide.sty 新增 9 个纯 TikZ 扁平图示组件
  (latflow latstack latcycle lathub latsteps
    lattime latquad latpyramid latcompare),
  颜色列表写在方括号里,支持多色循环取色,并有误用花括号的明确报错。
- slides.tex 新增 5 页演示;README 新增「图示组件(扁平风格)」一节 + figs/fig16.png。
- 设计基调为圆角色块 + 实心纯色 + 白字 + 细箭头,无渐变、无阴影、无立体。

本分支已用 TeX Live 2025 连编三遍验证:0 错误、0 溢出。
2026-10-13 15:11:22 +08:00
laoyang 51c7d852dc 新增三个深色颜色(苍松绿 / 暮山紫 / 琥珀橙)并同步要点框自动排布
一、新增颜色(放在 beamercolorthemeOUCSlide.sty)
  oucpine   苍松绿  RGB(30, 86, 64)    白字对比度 8.54
  oucdusk   暮山紫  RGB(92, 58, 118)   白字对比度 9.04
  oucamber  琥珀橙  RGB(196, 82, 16)   白字对比度 4.60
三个都是较深的颜色,与白色文字有足够对比度(WCAG >= 4.5),
可直接作色块底色;各自同样带 10 个色阶(如 oucpine10 ~ oucpine90)。
命名取自中文传统色:「苍松」「暮山紫」「琥珀」。
琥珀橙是高饱和深橘,与低饱和的暗褐「文脉棕」在饱和度上明显区分(0.98 vs 0.61)。

二、要点框自动排布 pointboxgrid(此前仅在 main 上,现同步到本分支)
每行最多 4 个,超过则均匀分成多行(5→3+2;6→3+3;7→4+3;8→4+4;9→3+3+3…),
用法见 README 的「要点框自动排布」一节。

三、验证
本分支已用 TeX Live 2025 重新编译验证:0 错误、0 溢出;
颜色样例页与要点框排布页均正常,三个新颜色在 PDF 中实际生效。
2026-10-13 08:45:59 +08:00
laoyang d6866bca64 修复目录页圆形序号在圈内偏上的问题,并在 TeX Live 2025 下重新编译
原因:徽标里用了 \strut,它把内容盒撑成「0.7 倍行距上高 + 0.3 倍行距下深」,
而数字没有下伸部,这段虚构的下深把数字整体推高,在圈里明显偏上
(实测偏上 1.7pt,大字号时可达 4pt)。去掉 \strut 后数字墨迹与圆心对齐。

顺带修正一个顺序错误:徽标直径原本在字号算出之前计算,读到的字号恒为 0,
导致圆圈大小与字号脱钩(永远退化到 1.15em)。现已移到字号之后计算。

圆的垂直位置不受影响。本分支已用 TeX Live 2025 重新编译验证:
0 错误、0 溢出、23 页,目录页 4 个跳转链接正常,徽标垂直偏差 ≤ 0.71pt。
2026-10-12 17:31:18 +08:00
laoyang fc1d08730b 目录页改为自适应方框样式,并在 TeX Live 2025 下编译验证
把每一个一级标题放进独立的方框,方框高度与字号随章节数目自动计算,
方框自动均分铺满整页;文字左对齐,左侧只留少量缩进。

新增 \settocstyle{box|solid|bar} 三种方框样式(未知值告警并回退 box),
新增 \toctheme{red|blue} 两种配色(默认海大红,与各章节标题页同色)。

本分支已用 TeX Live 2025 亲自编译验证:0 错误、0 溢出、23 页,
目录页 4 个跳转链接正常,且与本仓库其他分支渲染一致。
2026-10-12 11:29:16 +08:00
14 changed files with 1114 additions and 14 deletions
+255 -11
View File
@@ -4,7 +4,7 @@
本模板修改自<a href="https://github.com/Helmholtz-AI-Energy/beamer-template" target="_blank">HelmholtzAI</a>模板。在原有模板基础上进行了大量修改。
模板主要使用海大公布的标准色,包括海大蓝、海大天蓝、海大红、樱缤粉、文脉棕、专金、专银。
模板主要使用海大公布的标准色,包括海大蓝、海大天蓝、海大红、樱缤粉、文脉棕、专金、专银,以及后加的苍松绿、暮山紫、琥珀橙。
此外,使用了大量的信息框来增加模板的活力。
@@ -31,6 +31,64 @@
3. 可以安装其他的IDE工具进行Tex文件的编写和修改,推荐使用<a href="https://code.visualstudio.com/" target="_blank">Visual Studio Code</a>。
4. 编译时,请选择XeLaTex,有时候,可能需要连续编译两次,以得到正确的页码和图表编号。
# 分支与编译器版本
本仓库按 **TeX Live 年份**组织分支,规则很简单:**分支名是哪一年,就说明该分支可以用那一年的 TeX Live 直接编译通过**。
| 分支 | 对应 TeX Live | beamer 版本 | 说明 |
|------|---------------|-------------|------|
| `main` | 最新版 | 最新 | 始终指向最新的年份分支(当前等于 `2026`) |
| `2026` | TeX Live 2026 | 3.77 | 无需改动源码即可编译通过 |
| `2025` | TeX Live 2025 | 3.72 | 无需改动源码即可编译通过 |
| `2024` | TeX Live 2024 | 3.71 | 无需改动源码即可编译通过(PDF 体积说明见下) |
| `2023` | TeX Live 2023 | 3.69 | 适配 beamer 3.69 的 frametitle 变更,并修复 allcaps 选项 |
| `2022` | TeX Live 2022 | 3.66 | 保留早期 beamer 的写法(旧版 frametitle 补丁) |
### 两点说明
**一、各分支的 PDF 都是用对应年份的 TeX Live 编译出来的。**
也就是说,`2023` 分支里的 `slides.pdf` 出自 TeX Live 2023,
`2026` 分支里的出自 TeX Live 2026,以此类推。功能上各分支内容一致,
差别只在于适配各自 beamer 版本的源码写法。
**二、`2024` 分支的 PDF 体积明显偏大(约 9.7 MB,其他年份约 2.4 MB)。**
这是 TeX Live 2024 的 `xdvipdfmx` 一度不做跨页图像去重导致的,
从 TeX Live 2025 起恢复正常。**页面渲染内容与其他年份完全一致**,不影响使用。
## 我该用哪个分支
- **想用最新版本**:直接用 `main` 分支,并配合**最新版 TeX Live**。
- **本机已经装了某个特定年份的 TeX Live**:切到**同名的那个分支**即可。
```bash
# 例如本机是 TeX Live 2023,就用 2023 分支
git clone -b 2023 https://code.yangyq.net/laoyang/ouc-slide-latex-template.git
# 已经克隆过的仓库,可以这样切换
git checkout 2023
```
简单说:**编译器是哪一年的,就用哪一年的分支**,不需要自己去改模板代码。
## 为什么要这样分
beamer 的内部实现会随 TeX Live 版本变化,而模板中对内部宏的补丁(`\patchcmd`)会因此失效。最典型的一次是:
- **beamer 3.69(TeX Live 2023)** 起,`\beamer@@frametitle` 改用 `\beamer@insertframetitlecontinuation`,使得面向旧版写法的补丁匹配失败,报 `Patching original frame title failed`。
- 模板现已加入**版本自动判别**(依据 `\beamer@insertframetitlecontinuation` 是否存在,判断逻辑写在文件顶层),因此 `2023` 及之后的各年份分支**不需要再改动源码**。
- `2022` 分支保留原始写法,只保证在 TeX Live 2022(beamer 3.66)下编译通过。
## 维护约定
每当有新的 TeX Live 年份发布时:
1. 在新版本的 TeX Live 下,用 **XeLaTeX 编译当前的 `main`**;
2. 如果编译不通过,进行修复,注意保持向后兼容,不要破坏旧年份分支;
3. 修复通过后,新建一个**以该年份命名**的分支并提交;
4. 把该年份分支**快进合并到 `main`**,让 `main` 始终是最新版本。
> 附注:不同年份的 TeX Live 生成的 PDF 在体积上可能略有差异(例如 TeX Live 2024 的 xdvipdfmx 曾一度不做跨页图像去重,导致成品偏大约 4 倍),但**页面渲染内容是一致的**,不影响使用。
# 元素介绍
## 基本信息
Tex文件的开头,是基本信息部分,可以根据需要添加`\title`{标题}、`\subtitle`{子标题}、`\author`{作者}、`\date`{\today}、`\institute`{所属机构}。
@@ -50,6 +108,74 @@ Tex文件的开头,是基本信息部分,可以根据需要添加`\title`{
首页和结尾页,使用的是基本信息中的数据,而目录页的内容,将根据`\section`进行填充。
## 目录页样式(自适应方框)
目录页默认使用**自适应方框**样式:每一个一级标题(`\section`)被放进一个独立的方框里,**方框的高度、以及方框内文字的字号,都会根据一级标题的数目自动计算**,并且方框会自动均分、铺满整个目录页。章节少时方框又高又大、字号醒目;章节多时方框自动变矮、字号自动缩小,不需要手工调任何一个数字。
方框内的文字**左对齐**,左侧只留一点点缩进,读起来更像一份正常的目录。
![默认目录页样式](/figs/fig09.png)
### 配色:默认海大红,蓝色可选
目录页默认使用**海大红**(`oucred`)——和各章节标题页的颜色保持一致。
这是因为目录页上「目录」二字本身是**海大蓝**的,如果目录项再用蓝色,整页就分不出层次。用海大红正好和章节标题页呼应。
如果就喜欢蓝色,改一行即可切回海大蓝:
```
\toctheme{red} % 默认:海大红,与各章节标题页同色
\toctheme{blue} % 海大蓝,与目录页标题「目录」同色
```
![蓝色配色](/figs/fig13.png)
### 三种方框样式
在导言区用一行命令即可切换,样式与配色可以自由组合:
```
\settocstyle{box} % 默认:浅色底 + 圆角框 + 圆形序号
\settocstyle{solid} % 实心色底 + 白色文字
\settocstyle{bar} % 白底 + 左侧粗色条
```
![实心样式](/figs/fig10.png)
![左侧色条样式](/figs/fig11.png)
章节较多时(下面这张是 9 个一级标题),方框和字号会自动压缩:
![章节较多时自动压缩](/figs/fig12.png)
### 可调参数
所有参数都可以在导言区用 `\setlength` 覆盖,一般**不需要改**:
| 参数 | 默认值 | 含义 |
|------|--------|------|
| `\tocareamargin` | `52pt` | 目录区上下预留的高度(自动模式下从 `\textheight` 中扣除) |
| `\tocareaheight` | `0pt` | 直接指定目录区高度;`0pt` 表示自动 |
| `\tocboxgap` | `10pt` | 方框之间的理想间距(空间紧张时会自动压缩) |
| `\tocboxgapmin` | `2pt` | 方框之间允许的最小间距 |
| `\tocboxmaxheight` | `110pt` | 单个方框的最大高度 |
| `\tocboxleftpad` | `2.5pt` | 方框内文字距左边框的距离(只留一点点) |
| `\tocfontmax` | `26pt` | 方框内文字的最大字号 |
| `\tocfontwarn` | `8pt` | 字号低于该值时会给出警告 |
例如,希望方框之间更紧凑一些:
```
\setlength{\tocboxgap}{6pt}
```
### 几点说明
1. **目录页需要连续编译两次**:章节数目是从上一次编译生成的 `.toc` 文件里读出来的。第一次编译时 `.toc` 还是空的,目录页会是空白,再编译一次即可正常。
2. 方框的序号和标题是**超链接**,在 PDF 里点击会直接跳到对应章节。
3. 一级标题**太多时(大约 9 个以上)**,方框和字号会变得偏小,编译日志里会有 `oucslide Warning` 提示。这种情况下建议合并章节,或者把目录页改回普通的列表样式。
4. 如果确实想换回旧版那种简洁的列表目录,把 `\makeoutline` 里的 `\ouc@toc@body` 换回 `\tableofcontents[hideallsubsections]` 即可(旧的模板定义仍保留在 `beamerouterthemeOUCSlide.sty` 中)。
## 使用分节
本模板使用分节进行整体规划,章节共三级,对应的关键字分别是:
@@ -95,18 +221,44 @@ Tex文件的开头,是基本信息部分,可以根据需要添加`\title`{
推荐的字体包括:<a href="https://github.com/adobe-fonts/source-han-sans" target="_blank">思源黑体</a>、<a href="https://alibabafont.taobao.com/wow/alibabafont/act/alifont" target="_blank">阿里普惠字体</a>、<a href="https://www.thosefree.com/oppo-sans" target="_blank">OPPO字体</a>、<a href="https://web.vip.miui.com/page/info/mio/mio/detail?postId=33935854" target="_blank">小米字体</a>。这些字体基本上都可以免费商用,并且效果都很不错。关于他们是否能够继续免费商用的政策,请查阅其官方网站以得到最准确的信息。
## 颜色
根据海大公布的标准颜色,定义了相关颜色,主要包括海大蓝、海大天蓝、海大红、樱缤粉、文脉棕、专金、专银。其中文名称和代码如下表所示。
根据海大公布的标准颜色,定义了相关颜色。其中文名称和代码如下表所示。
当然,也可以使用LaTex自带的颜色,例如white、black等。
| 名称 | 中文名 |
|--------------|--------------|
| oucblue | 海大蓝 |
| ouclightblue | 海大天蓝 |
| oucred | 海大红 |
| ouccherry | 樱缤粉 |
| oucbrown | 文脉棕 |
| oucgolden | 专金 |
| oucsilver | 专银 |
| 名称 | 中文名 | 说明 |
|--------------|--------------|------|
| oucblue | 海大蓝 | 海大标准色 |
| ouclightblue | 海大天蓝 | 海大标准色 |
| oucred | 海大红 | 海大标准色 |
| ouccherry | 樱缤粉 | 海大标准色 |
| oucbrown | 文脉棕 | 海大标准色 |
| oucgolden | 专金 | 海大标准色 |
| oucsilver | 专银 | 海大标准色 |
| oucpine | 苍松绿 | 新增,深绿 |
| oucdusk | 暮山紫 | 新增,深紫 |
| oucamber | 琥珀橙 | 新增,深橘 |
### 新增的三个颜色
已有的浅色(樱缤粉、专金、专银)在内容多的时候不太够用,因此补充了三个**较深的颜色**——
深色的好处是**和白色文字有足够的对比度**,可以直接当作色块底色(`pointbox`、`titlebox`、
`block` 等)使用,不必再担心白字看不清。
| 名称 | 色值 | 白字对比度 | 命名与定位 |
|------|------|-----------|-----------|
| `oucpine` | RGB 30, 86, 64 | 8.54 | **苍松绿**——取自传统色「苍松」,色相偏青的深绿,沉静稳重 |
| `oucdusk` | RGB 92, 58, 118 | 9.04 | **暮山紫**——取自传统色「暮山紫」(暮色中的远山),深紫而不艳 |
| `oucamber` | RGB 196, 82, 16 | 4.60 | **琥珀橙**——取自传统色「琥珀」,高饱和的深橘 |
三点说明:
1. **琥珀橙和文脉棕不会混淆**:文脉棕是「低饱和的暗褐」,琥珀橙是「高饱和的深橘」,
两者在饱和度上拉开了明显差距(色相接近,但饱和度 0.61 vs 0.98)。
2. 三个新颜色**同样带十个色阶**(`oucpine10` ~ `oucpine90` 等),浅色等级可以当背景底。
3. 对比度按 WCAG 计算,**≥ 4.5 即白字清晰可读**。三个新颜色都在 4.5 以上
(对比度越高,白字越清晰)。
![新增颜色的应用](/figs/fig15.png)
## 颜色等级
为了显示更丰富的色彩,定义的海大标准色,每一种颜色,都有十个等级,等级越低,颜色越浅。例如:对于海大蓝,其等级颜色从oucblue90-oucblue10不等,分成10个等级。
@@ -123,6 +275,98 @@ Tex文件的开头,是基本信息部分,可以根据需要添加`\title`{
![块](/figs/fig07.png)
![标题框和文本框](/figs/fig08.png)
### 要点框自动排布(pointboxgrid)
要点框数量多的时候,不需要自己摆 `columns`——用 `pointboxgrid` 环境会自动排成网格:
```
\begin{pointboxgrid}{高度}
\pointitem{标题}{颜色}{内容}
\pointitem{标题}{颜色}{内容}
...
\end{pointboxgrid}
```
**排布规则:每行最多 4 个;超过 4 个自动分成多行,并尽量均匀(上行不少于下行)。**
| 个数 | 排布 | 个数 | 排布 |
|------|------|------|------|
| 1~4 | 一行 | 9 | 3 + 3 + 3 |
| 5 | 3 + 2 | 10 | 4 + 3 + 3 |
| 6 | 3 + 3 | 11 | 4 + 4 + 3 |
| 7 | 4 + 3 | 12 | 4 + 4 + 4 |
| 8 | 4 + 4 | N | 行数 = ⌈N/4⌉,前 N mod 行数 行每行多放一个 |
![自动排布总览(1~12 个)](/figs/fig14.png)
几点说明:
1. **高度参数的含义和 `pointbox` 的 `height` 一样**,是固定高度——内容别写超,超了会画到框外(见下)。数量多时记得**把高度调小**。
2. **行数多了会超出页面底部**。经验值:正文区高约 243pt,总高 ≈ `69 + 行数×高度 + (行数−1)×25`(pt)。
所以 **4 行时高度不要超过 24pt**。超过时编译日志里会有 `oucslide Warning` 提醒。
3. 想让每行放更多/更少,可改 `\l_ouc_pbg_max`(默认 4);间距可改 `\l_ouc_pbg_gap`(横向,默认 8pt)与
`\l_ouc_pbg_vgap`(纵向,默认 6pt)。
4. 单个要点框仍然可以像以前那样手写 `columns` + `pointbox`,两种用法并存。
## 图示组件(扁平风格)
模板自带 9 个**扁平简约**图示组件:圆角色块 + 实心纯色 + 白字 + 细箭头,
**无渐变、无阴影、无立体**。全部用纯 TikZ 绘制,不依赖任何外部绘图宏包。
![图示组件](/figs/fig16.png)
### 颜色:一个或多个都可以
所有组件的**颜色列表写在方括号里**(可选参数)。写一个就是全部同色,
写多个就**按顺序取色、不够时自动循环**:
```
\flatflow[oucblue]{数据采集, 数据清洗, 模型训练, 结果评估} % 全部海大蓝
\flatflow[oucblue,oucred,oucpine,oucamber]{数据采集, 数据清洗, 模型训练, 结果评估}
% ← 4 个块 4 种颜色
\flatflow[oucred,oucblue]{块一, 块二, 块三, 块四, 块五, 块六}
% ← 2 色循环:红蓝红蓝红蓝
```
> ⚠️ 颜色**必须写成方括号 `[ ]`**。若误写成花括号 `{ }`,颜色会被当成第一个条目,
> 编译时会报 `图示组件的颜色要写在方括号里` 的明确错误(不会静默出错)。
### 九个组件速查
| 命令 | 说明 |
|------|------|
| `\flatflow[颜色]{条目1, 条目2, ...}` | **横向箭头流程**,自动等分满宽 |
| `\flatstack[颜色]{条目1, 条目2, ...}` | 纵向流程 |
| `\flatcycle[颜色]{条目1, ...}` | 循环图(弧线箭头首尾相接) |
| `\flathub[颜色]{中心文字}{环绕1, 环绕2, ...}` | **中心辐射**(中心圆 + 环绕卡片) |
| `\flatsteps[颜色]{条目1, ...}` | 阶梯递进 |
| `\flattime[颜色]{年份列表}{事件列表}` | 时间轴(节点上下交替) |
| `\flatquad[颜色]{左上}{右上}{左下}{右下}` | 四象限 |
| `\flatpyramid[颜色]{顶层, ..., 底层}` | 金字塔(上窄下宽) |
| `\flatcompare[左色][右色]{左标题}{左内容}{右标题}{右内容}` | 左右对比 |
示例(`slides.tex` 里有完整的 5 页演示):
```
\flatflow[oucblue,oucred,oucpine,oucamber]{数据采集, 数据清洗, 模型训练, 结果评估}
\flathub[oucblue,oucred,oucpine,oucamber,oucdusk]{核心}{可行性, 必要性, 创新性, 实用性}
\flattime[oucblue,oucred,oucpine,oucdusk]{2020, 2021, 2023, 2025}{立项, 方案设计, 中期检查, 结题验收}
\flatcompare[oucpine][oucred]{优势}{响应快、成本低、易于维护}{不足}{精度受限、依赖数据质量}
```
`\flatquad` 与 `\flatcompare` 的颜色是独立的固定参数(分别 1 个和 2 个),
不参与循环取色。
### 几点说明
1. 颜色可以直接用模板的 10 个颜色(`oucblue`、`oucred`、`oucpine`、`oucdusk`、`oucamber` 等)。
2. 横向流程会自动把 N 个块加间隙**摊满整行**,不需要手算宽度。
3. 纵向对比、四象限这类元素较宽,建议用 `\begin{center}...\end{center}` 居中。
4. 这套组件已用 TeX Live 2022~2026 逐一编译验证:0 错误、0 溢出,且跨版本渲染逐像素一致。
## 代码
模板可以插入代码块,使用`lstlisting`即可。
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
View File
Binary file not shown.
+111 -1
View File
@@ -99,7 +99,7 @@
\frametitle{颜色}
%\framesubtitle{基本颜色}
根据海大公布的标准颜色,定义了相关颜色,主要包括海大蓝、海大天蓝、海大红、樱缤粉、文脉棕、专金、专银。其中文名称和代码如表\ref{table:color}所示。\\
根据海大公布的标准颜色,定义了相关颜色,主要包括海大蓝、海大天蓝、海大红、樱缤粉、文脉棕、专金、专银,以及后加的苍松绿、暮山紫、琥珀橙。其中文名称和代码如表\ref{table:color}所示。\\
当然,也可以使用LaTex自带的颜色,例如white、black等。
\begin{table}
@@ -114,12 +114,52 @@
\crule[oucred]{10pt}{10pt} & oucred & 海大红 \\
\crule[ouccherry]{10pt}{10pt} & ouccherry & 樱缤粉 \\
\crule[oucbrown]{10pt}{10pt} & oucbrown & 文脉棕 \\
\end{tabular}
\hspace{1.6em}
\begin{tabular}{ccc}
\textbf{颜色} & \textbf{名称} & \textbf{中文名}\\\toprule
\crule[oucgolden]{10pt}{10pt} & oucgolden & 专金 \\
\crule[oucsilver]{10pt}{10pt} & oucsilver & 专银 \\
\crule[oucpine]{10pt}{10pt} & oucpine & 苍松绿 \\
\crule[oucdusk]{10pt}{10pt} & oucdusk & 暮山紫 \\
\crule[oucamber]{10pt}{10pt} & oucamber & 琥珀橙 \\
\end{tabular}
\end{table}
\end{frame}
\subsubsection{新增颜色的应用}
\begin{frame}
\frametitle{新增颜色的应用}
后加的三种颜色都是\textbf{较深的颜色},和白色文字有足够对比度,
可以直接当作色块底色使用,也可以像其他颜色一样用它的浅色等级(如 \texttt{oucpine20})作背景。\\
\begin{columns}
\begin{column}{0.32\textwidth}
\begin{pointbox}[苍松绿]{oucpine}{74pt}
沉静稳重\\
适合与暖色交替\\
色相偏青的深绿
\end{pointbox}
\end{column}
\begin{column}{0.32\textwidth}
\begin{pointbox}[暮山紫]{oucdusk}{74pt}
深紫而不艳\\
冷暖之间的过渡\\
适合做第三色
\end{pointbox}
\end{column}
\begin{column}{0.32\textwidth}
\begin{pointbox}[琥珀橙]{oucamber}{74pt}
高饱和的深橘\\
与文脉棕差别明显\\
强调时比红色柔和
\end{pointbox}
\end{column}
\end{columns}
\end{frame}
\subsubsection{颜色等级}
\begin{frame}
@@ -268,6 +308,76 @@
\end{frame}
\subsection{图示组件}
\begin{frame}
\frametitle{横向流程}
流程类图示用 \texttt{\textbackslash flatflow},条目用逗号分隔,自动等分排布。\\
颜色写在方括号里:写一个则全部同色,写多个则按顺序取色。\\
\vspace{4pt}
\textbf{单色:}
\begin{center}
\flatflow[oucblue]{数据采集, 数据清洗, 模型训练, 结果评估}
\end{center}
\vspace{4pt}
\textbf{每个块不同颜色:}
\begin{center}
\flatflow[oucblue,oucred,oucpine,oucamber]{数据采集, 数据清洗, 模型训练, 结果评估}
\end{center}
\end{frame}
\begin{frame}
\frametitle{纵向流程与循环}
\begin{columns}
\begin{column}{0.42\textwidth}
\centering
\flatstack[oucblue,oucred,oucpine,oucdusk]{提出问题, 建立模型, 求解验证}
\end{column}
\begin{column}{0.42\textwidth}
\centering
\flatcycle[oucblue,oucred,oucpine,oucamber]{计划, 执行, 检查, 改进}
\end{column}
\end{columns}
\end{frame}
\begin{frame}
\frametitle{中心辐射}
\begin{center}
\flathub[oucblue,oucred,oucpine,oucamber,oucdusk]{核心}{可行性, 必要性, 创新性, 实用性}
\end{center}
\end{frame}
\begin{frame}
\frametitle{阶梯递进}
\begin{center}
\flatsteps[oucblue,oucred,oucpine,oucamber]{基础研究, 技术开发, 集成验证, 示范应用}
\end{center}
\end{frame}
\begin{frame}
\frametitle{时间轴与四象限}
\begin{center}
\flattime[oucblue,oucred,oucpine,oucdusk]{2020, 2021, 2023, 2025}{立项, 方案设计, 中期检查, 结题验收}
\end{center}
\vspace{8pt}
\begin{center}
\flatquad[oucblue,oucred,oucpine,oucamber]{重要且紧急}{重要不紧急}{紧急不重要}{不重要不紧急}
\end{center}
\end{frame}
\begin{frame}
\frametitle{金字塔与对比}
\begin{center}
\flatpyramid[oucblue,oucred,oucpine,oucamber]{总体目标, 实施策略, 具体措施, 落地行动}
\end{center}
\vspace{6pt}
\begin{center}
\flatcompare[oucpine][oucred]{优势}{响应快、成本低、易于维护}{不足}{精度受限、依赖数据质量}
\end{center}
\end{frame}
\subsection{块}
\begin{frame}
+40
View File
@@ -89,6 +89,46 @@
\colorlet{oucsilver80}{oucsilver!80!white}
\colorlet{oucsilver90}{oucsilver!90!white}
%% OUC Pine 苍松绿
%% 苍松绿:取自中文传统色「苍松」。色相偏青的深绿,沉静稳重,
%% 与海大蓝同属冷色系但明显更深、更偏绿,适合与暖色交替使用。
\definecolor{oucpine}{RGB}{30, 86, 64}
\colorlet{oucpine10}{oucpine!10!white}
\colorlet{oucpine20}{oucpine!20!white}
\colorlet{oucpine30}{oucpine!30!white}
\colorlet{oucpine40}{oucpine!40!white}
\colorlet{oucpine50}{oucpine!50!white}
\colorlet{oucpine60}{oucpine!60!white}
\colorlet{oucpine70}{oucpine!70!white}
\colorlet{oucpine80}{oucpine!80!white}
\colorlet{oucpine90}{oucpine!90!white}
%% OUC Dusk 暮山紫
%% 暮山紫:取自中文传统色「暮山紫」(暮色中的远山)。深紫而不艳,
%% 兼具蓝色的沉稳与红色的温度,是很好的第三色。
\definecolor{oucdusk}{RGB}{92, 58, 118}
\colorlet{oucdusk10}{oucdusk!10!white}
\colorlet{oucdusk20}{oucdusk!20!white}
\colorlet{oucdusk30}{oucdusk!30!white}
\colorlet{oucdusk40}{oucdusk!40!white}
\colorlet{oucdusk50}{oucdusk!50!white}
\colorlet{oucdusk60}{oucdusk!60!white}
\colorlet{oucdusk70}{oucdusk!70!white}
\colorlet{oucdusk80}{oucdusk!80!white}
\colorlet{oucdusk90}{oucdusk!90!white}
%% OUC Amber 琥珀橙
%% 琥珀橙:取自传统色「琥珀」。高饱和的深橘,
%% 与文脉棕(低饱和的暗褐)在饱和度上拉开明显差距,两者不会混淆。
\definecolor{oucamber}{RGB}{196, 82, 16}
\colorlet{oucamber10}{oucamber!10!white}
\colorlet{oucamber20}{oucamber!20!white}
\colorlet{oucamber30}{oucamber!30!white}
\colorlet{oucamber40}{oucamber!40!white}
\colorlet{oucamber50}{oucamber!50!white}
\colorlet{oucamber60}{oucamber!60!white}
\colorlet{oucamber70}{oucamber!70!white}
\colorlet{oucamber80}{oucamber!80!white}
\colorlet{oucamber90}{oucamber!90!white}
%代码注释的颜色
\definecolor{mygreen}{rgb}{0,0.6,0}
+463 -1
View File
@@ -125,6 +125,183 @@
title=#1
}
%% ======================================================================
%% 要点框自动排布:pointboxgrid
%% ----------------------------------------------------------------------
%% 把任意多个要点自动排成「每行最多 4 个」的网格:
%% \begin{pointboxgrid}{高度}
%% \pointitem{标题}{颜色}{内容}
%% ...
%% \end{pointboxgrid}
%%
%% 排布规则(行数尽可能少,并尽量均匀):
%% 1~4 个 → 一行
%% 5 个 → 上行 3 + 下行 2
%% 6 个 → 3 + 3
%% 7 个 → 4 + 3
%% 8 个 → 4 + 4
%% 9 个 → 3 + 3 + 3
%% 10 个 → 4 + 3 + 3
%% 11 个 → 4 + 4 + 3
%% 12 个 → 4 + 4 + 4
%% 一般地:行数 = ceil(N/4),前 N mod 行数 行每行多放 1 个。
%%
%% 说明:
%% - 高度参数与 pointbox 的 height 含义相同(固定高度,内容别超出)。
%% - 较多行时请自行减小高度,避免总高超出页面(建议行数 ≤ 4)。
%% - 「每行最多几个」由 \ouc_pbg_max 控制;间距由 \ouc_pbg_gap /
%% \ouc_pbg_vgap 控制,需要时在导言区改这两个长度。
%% ======================================================================
\ExplSyntaxOn
\int_new:N \l_ouc_pbg_cnt
\int_new:N \l_ouc_pbg_n
\int_new:N \l_ouc_pbg_rows
\int_new:N \l_ouc_pbg_base
\int_new:N \l_ouc_pbg_rem
\int_new:N \l_ouc_pbg_k
\int_new:N \l_ouc_pbg_km
\int_new:N \l_ouc_pbg_i
\int_new:N \l_ouc_pbg_max
\dim_new:N \l_ouc_pbg_est
\dim_new:N \l_ouc_pbg_colw
\dim_new:N \l_ouc_pbg_gap
\dim_new:N \l_ouc_pbg_vgap
\dim_new:N \l_ouc_pbg_h
\int_set:Nn \l_ouc_pbg_max { 4 }
\dim_new:N \l_ouc_pbg_avail
\dim_set:Nn \l_ouc_pbg_avail { 243pt }
\dim_set:Nn \l_ouc_pbg_gap { 8pt }
\dim_set:Nn \l_ouc_pbg_vgap { 6pt }
%% 收集一个要点:内容按原样存进带索引的宏,不做任何展开
\NewDocumentCommand \pointitem { m m m }
{
\int_incr:N \l_ouc_pbg_cnt
\tl_set:cn { l_ouc_pbg_t_ \int_use:N \l_ouc_pbg_cnt } {#1}
\tl_set:cn { l_ouc_pbg_c_ \int_use:N \l_ouc_pbg_cnt } {#2}
\tl_set:cn { l_ouc_pbg_b_ \int_use:N \l_ouc_pbg_cnt } {#3}
}
%% 画一个要点框:按序号直接取用存好的宏
\cs_new_protected:Npn \ouc_pbg_emit:n #1
{
\begin{pointbox}
[ \tl_use:c { l_ouc_pbg_t_#1 } ]
{ \tl_use:c { l_ouc_pbg_c_#1 } }
{ \dim_use:N \l_ouc_pbg_h }
\tl_use:c { l_ouc_pbg_b_#1 }
\end{pointbox}
}
%% 列宽 = (正文宽 - (k-1)*间距) / k
%% 注:某些 TeX Live 下 expl3 的维度乘法(*)会静默算出 0,
%% 因此走 fp_eval + dim_to_fp 的浮点路径,稳妥。
\cs_new_protected:Nn \ouc_pbg_setcolw:
{
\int_set:Nn \l_ouc_pbg_km { \int_use:N \l_ouc_pbg_k - 1 }
\dim_set:Nn \l_ouc_pbg_colw
{
\fp_eval:n
{
( \dim_to_fp:n { \textwidth }
- \int_use:N \l_ouc_pbg_km * \dim_to_fp:n { \l_ouc_pbg_gap } )
/ \int_use:N \l_ouc_pbg_k
}
pt
}
}
\cs_new_protected:Nn \ouc_pbg_typeset:
{
\int_set:Nn \l_ouc_pbg_n { \int_use:N \l_ouc_pbg_cnt }
\int_compare:nNnT { \int_use:N \l_ouc_pbg_n } > { 0 }
{
%% 行数 = ceil(N / max)
\int_set:Nn \l_ouc_pbg_rows
{
\int_div_truncate:nn
{ \int_use:N \l_ouc_pbg_n + \int_use:N \l_ouc_pbg_max - 1 }
{ \int_use:N \l_ouc_pbg_max }
}
%% 均匀分配:前 rem 行每行多 1 个(上行不少于下行)
\int_set:Nn \l_ouc_pbg_base
{
\int_div_truncate:nn
{ \int_use:N \l_ouc_pbg_n } { \int_use:N \l_ouc_pbg_rows }
}
\int_set:Nn \l_ouc_pbg_rem
{
\int_use:N \l_ouc_pbg_n
- \int_use:N \l_ouc_pbg_base * \int_use:N \l_ouc_pbg_rows
}
%% 预估总高度并与正文可用高度比较(公式按实测校准):
%% 总高 ≈ 69pt(首行含标题条) + 行数*高度 + (行数-1)*25pt(行间距)
\dim_set:Nn \l_ouc_pbg_est
{
\fp_eval:n
{
69
+ \int_use:N \l_ouc_pbg_rows * \dim_to_fp:n { \l_ouc_pbg_h }
+ ( \int_use:N \l_ouc_pbg_rows - 1 ) * 25
}
pt
}
\ifdim \l_ouc_pbg_est > \l_ouc_pbg_avail
\PackageWarning{oucslide}
{
要点框共 \int_use:N \l_ouc_pbg_n\space 个,排成
\int_use:N \l_ouc_pbg_rows\space 行、每框高 \dim_use:N \l_ouc_pbg_h,
预估总高 \dim_use:N \l_ouc_pbg_est\space 已超过正文可用高度
\dim_use:N \l_ouc_pbg_avail,可能超出页面底部。
请把高度改小(4 行时建议不超过 24pt)或减少要点个数
}
\fi
\int_zero:N \l_ouc_pbg_i
\int_step_inline:nn { \int_use:N \l_ouc_pbg_rows }
{
\int_set:Nn \l_ouc_pbg_k { \int_use:N \l_ouc_pbg_base }
%% 注意:此处的比较必须用 \ifnum。
%% expl3 的 \int_compare:nNnT 在这套 TeX Live 下判定有误,
%% 会把所有 ##1 都判成"小于等于",导致行内个数分配失效。
\ifnum ##1 > \int_use:N \l_ouc_pbg_rem \else
\int_incr:N \l_ouc_pbg_k
\fi
\ouc_pbg_setcolw:
%% 必须用 [onlytextwidth],否则默认 columns 会带来
%% 左/右边距,4 列时左右各溢出约 10pt。
\begin{columns}[onlytextwidth]
\int_step_inline:nn { \int_use:N \l_ouc_pbg_k }
{
\int_incr:N \l_ouc_pbg_i
\begin{column}{\dim_use:N \l_ouc_pbg_colw}
\ouc_pbg_emit:n { \int_use:N \l_ouc_pbg_i }
\end{column}
}
\end{columns}
\ifnum ##1 < \int_use:N \l_ouc_pbg_rows
\vspace{\dim_use:N \l_ouc_pbg_vgap}
\fi
}
}
}
%% 友好设置:\pointboxsetup{每行最多几个}{横向间距}{纵向间距}
%% 例如 \pointboxsetup{5}{6pt}{4pt}
\NewDocumentCommand \pointboxsetup { m m m }
{
\int_set:Nn \l_ouc_pbg_max {#1}
\dim_set:Nn \l_ouc_pbg_gap {#2}
\dim_set:Nn \l_ouc_pbg_vgap {#3}
}
\NewDocumentEnvironment { pointboxgrid } { m }
{ \int_zero:N \l_ouc_pbg_cnt \dim_set:Nn \l_ouc_pbg_h {#1} }
{ \ouc_pbg_typeset: }
\ExplSyntaxOff
%% ======================================================================
%文本框textbox
\newtcolorbox{textbox}[1]{
colback=#1!5!white,
@@ -149,4 +326,289 @@
\renewcommand{\figurename}{图}
\renewcommand{\tablename}{表}
\renewcommand{\lstlistingname}{代码}
\renewcommand{\abstractname}{摘要}
\renewcommand{\abstractname}{摘要}
%% ======================================================================
%% 扁平简约图示组件 (flat diagrams)
%% ---------------------------------------------------------------------
%% 设计基调:圆角块 + 实心纯色 + 白字 + 细箭头
%% **无渐变、无阴影、无立体**
%%
%% 所有组件都支持「颜色列表」:写一个颜色则全部同色;
%% 写多个颜色(逗号分隔)则按顺序循环取色。
%% \flatflow{oucblue} % 4 个块全为海大蓝
%% \flatflow{oucblue,oucred,oucpine} % 4 个块循环取这 3 色
%% \flatflow{oucblue,oucred,oucpine,oucdusk,oucamber} % 5 色各不同
%% ======================================================================
\RequirePackage{tikz}
\usetikzlibrary{positioning,arrows.meta,calc,shapes.geometric}
%% ---------------- 防错:颜色参数必须写在 [] 里 ----------------
%% \flatflow 这类命令的「颜色列表」是可选参数,必须写成方括号 [颜色]。
%% 若误写成花括号 {颜色},颜色会被当成第一个条目(静默出错、极难排查),
%% 因此这里检查每个条目是不是模板的颜色名,是则明确报错。
\newcommand{\flcheckitems}[1]{%
\foreach \flci in {#1}{%
%% 注意:\foreach 每轮迭代会开组,内层的 \def 出组即失效,
%% 因此这里必须用 \global\def(否则检测永远不触发)。
\global\def\flhit{0}%
\foreach \flck in {oucblue,ouclightblue,oucred,ouccherry,oucbrown,%
oucgolden,oucsilver,oucpine,oucdusk,oucamber}{%
%% 注意:此处 \ifstrequal 在本机不生效(恒为假),必须用 \ifx
\ifx\flci\flck\global\def\flhit{1}\fi
}%
\ifnum\flhit=1
\PackageError{oucslide}{图示组件的颜色要写在方括号里}{%
命令 \string\flatflow[颜色列表]{条目1, 条目2} 中的颜色是可选参数,%
必须用方括号 [ ],不能用花括号 { }。\MessageBreak
现在「\flci」被当成了条目内容(它看起来是颜色名)。}%
\fi
}%
}
%% ---------------- 辅助:长度 / 计数 / 取色 ----------------
\newlength\flgap
\newlength\flbw
\newcount\flcnt
\def\flcntval{0}
%% 数条目个数,并存成**纯数字宏**(本机 pgfmath 的算式里不能出现计数器)
\newcommand{\flcount}[1]{%
\flcnt=0
\foreach \flzz in {#1}{\global\advance\flcnt by 1}%
\xdef\flcntval{\the\flcnt}%
}
\newcount\flcolcnt
\def\flcoln{0}
\newcommand{\flcolcount}[1]{%
\flcolcnt=0
\foreach \flzz in {#1}{\global\advance\flcolcnt by 1}%
\xdef\flcoln{\the\flcolcnt}%
}
\def\flcur{oucblue}
\def\flmain{oucblue}
%% 第 #2 个块取颜色列表 #1 中的颜色(超出则循环),结果存进 \flcur
\newcommand{\flpick}[2]{%
\pgfmathtruncatemacro{\flidx}{mod(#2-1,\flcoln)+1}%
\foreach \flzz [count=\fljj] in {#1}{%
\ifnum\fljj=\flidx \xdef\flcur{\flzz}\fi
}%
}
%% 取列表第一项作为「主色」(箭头、轴线等用)
\newcommand{\flsetmain}[1]{\flpick{#1}{1}\xdef\flmain{\flcur}}
%% ---------------- 公共样式 ----------------
\tikzset{
flblk/.style={rectangle, rounded corners=2pt, draw=none,
text=white, align=center, inner sep=4pt, font=\small},
flblkl/.style={rectangle, rounded corners=2pt, draw=none,
align=center, inner sep=4pt, font=\footnotesize},
flarr/.style={line width=1pt, -{Stealth[length=1.7mm,width=1.4mm]}}
}
%% ================== 1. 横向箭头流程 ==================
%% \flatflow[颜色列表]{条目1, 条目2, ...}
\NewDocumentCommand \flatflow { O{oucblue} m }{{%
\flcheckitems{#2}\flcount{#2}\flcolcount{#1}\flsetmain{#1}%
\setlength{\flgap}{16pt}%
\pgfmathsetlength{\flbw}{(0.99\textwidth-(\flcntval-1)*\flgap)/\flcntval}%
\begin{tikzpicture}
\foreach \flx [count=\fli] in {#2} {
\flpick{#1}{\fli}%
\pgfmathtruncatemacro{\flprev}{\fli-1}
\ifnum\fli=1
\node[flblk, fill=\flcur, minimum height=20pt,
text width=\dimexpr\flbw-8pt\relax] (fn1) at (0,0) {\flx};
\else
\node[flblk, fill=\flcur, minimum height=20pt,
text width=\dimexpr\flbw-8pt\relax,
right=\flgap of fn\flprev] (fn\fli) {\flx};
\fi
}%
\foreach \flx [count=\fli] in {#2} {
\ifnum\fli>1
\pgfmathtruncatemacro{\flprev}{\fli-1}
\draw[flarr, draw=\flmain!70!black] (fn\flprev.east) -- (fn\fli.west);
\fi
}%
\end{tikzpicture}%
}}
%% ================== 2. 纵向流程 ==================
\NewDocumentCommand \flatstack { O{oucblue} m }{{%
\flcheckitems{#2}\flcount{#2}\flcolcount{#1}\flsetmain{#1}%
\begin{tikzpicture}
\foreach \flx [count=\fli] in {#2} {
\flpick{#1}{\fli}%
\pgfmathtruncatemacro{\flprev}{\fli-1}
\ifnum\fli=1
\node[flblk, fill=\flcur, minimum height=18pt,
minimum width=0.7\textwidth] (fn1) at (0,0) {\flx};
\else
\node[flblk, fill=\flcur, minimum height=18pt,
minimum width=0.7\textwidth, below=8pt of fn\flprev] (fn\fli) {\flx};
\fi
}%
\foreach \flx [count=\fli] in {#2} {
\ifnum\fli>1
\pgfmathtruncatemacro{\flprev}{\fli-1}
\draw[flarr, draw=\flmain!70!black] (fn\flprev.south) -- (fn\fli.north);
\fi
}%
\end{tikzpicture}%
}}
%% ================== 3. 循环图 ==================
\NewDocumentCommand \flatcycle { O{oucblue} m }{{%
\flcheckitems{#2}\flcount{#2}\flcolcount{#1}\flsetmain{#1}%
\begin{tikzpicture}
\foreach \flx [count=\fli] in {#2} {
\flpick{#1}{\fli}%
\pgfmathsetmacro{\flang}{90-360/\flcntval*(\fli-1)}
\node[circle, fill=\flcur, text=white, align=center, inner sep=1pt,
minimum size=32pt, font=\footnotesize] (cn\fli) at (\flang:34pt) {\flx};
}%
\foreach \flx [count=\fli] in {#2} {
\pgfmathtruncatemacro{\flnext}{mod(\fli,\flcntval)+1}
\draw[flarr, draw=\flmain!50!black] (cn\fli) to[bend left=20] (cn\flnext);
}%
\end{tikzpicture}%
}}
%% ================== 4. 中心辐射 ==================
%% \flathub[颜色列表]{中心文字}{环绕1, 环绕2, ...}
\NewDocumentCommand \flathub { O{oucblue} m m }{{%
\flcheckitems{#3}\flcount{#3}\flcolcount{#1}\flsetmain{#1}%
\begin{tikzpicture}
\foreach \flx [count=\fli] in {#3} {
\flpick{#1}{\fli+1}% % 环绕从颜色列表第 2 项起取色
\pgfmathsetmacro{\flang}{90-360/\flcntval*(\fli-1)}
\node[rectangle, rounded corners=2pt, draw=\flcur!30!white, line width=0.6pt,
fill=\flcur!7!white, text=\flcur!55!black, align=center, inner sep=3pt,
font=\footnotesize, minimum height=17pt] (ln\fli) at (\flang:3.1cm) {\flx};
\draw[draw=\flcur!40!white, line width=0.7pt] (0,0) -- (ln\fli);
}%
\flsetmain{#1}%
\node[circle, fill=\flmain, text=white, align=center, inner sep=2pt,
minimum size=40pt, font=\small\bfseries] at (0,0) {#2};
\end{tikzpicture}%
}}
%% ================== 5. 阶梯递进 ==================
\NewDocumentCommand \flatsteps { O{oucblue} m }{{%
\flcheckitems{#2}\flcolcount{#1}%
\begin{tikzpicture}
\foreach \flx [count=\fli] in {#2} {
\flpick{#1}{\fli}%
\pgfmathsetlengthmacro{\flsx}{(\fli-1)*2.6cm}
\pgfmathsetlengthmacro{\flsy}{(\fli-1)*13pt}
\node[flblk, fill=\flcur, minimum height=16pt, minimum width=2.4cm,
anchor=south west] at (\flsx,\flsy) {\flx};
}%
\end{tikzpicture}%
}}
%% ================== 6. 时间轴 ==================
%% \flattime[颜色列表]{年份列表}{事件列表}
\NewDocumentCommand \flattime { O{oucblue} m m }{{%
\flcheckitems{#2}\flcheckitems{#3}\flcount{#2}\flcolcount{#1}\flsetmain{#1}%
\begin{tikzpicture}
\pgfmathsetlengthmacro{\flstep}{0.9\textwidth/\flcntval}%
\draw[line width=1.8pt, draw=\flmain,
-{Stealth[length=2mm,width=1.6mm]}] (0,0) -- (0.9\textwidth,0);
\foreach \fly [count=\fli] in {#2} {
\flpick{#1}{\fli}%
\pgfmathsetlengthmacro{\flxx}{(\fli-0.5)*\flstep}
\node[circle, fill=\flcur, minimum size=6pt, inner sep=0pt] at (\flxx,0) {};
\node[rectangle, fill=\flcur, text=white, inner sep=2.5pt,
font=\footnotesize\bfseries, rounded corners=1pt]
at (\flxx,0.22cm) {\fly};
}%
\foreach \fle [count=\fli] in {#3} {
\flpick{#1}{\fli}%
\pgfmathsetlengthmacro{\flxx}{(\fli-0.5)*\flstep}
\ifodd\fli
\node[flblkl, fill=\flcur!7!white, draw=\flcur!25!white, line width=0.5pt,
text=\flcur!55!black, text width=2.3cm, anchor=south]
at (\flxx,0.45cm) {\fle};
\else
\node[flblkl, fill=\flcur!7!white, draw=\flcur!25!white, line width=0.5pt,
text=\flcur!55!black, text width=2.3cm, anchor=north]
at (\flxx,-0.22cm) {\fle};
\fi
}%
\end{tikzpicture}%
}}
%% ================== 7. 四象限 ==================
%% \flatquad[颜色列表]{左上}{右上}{左下}{右下}
\NewDocumentCommand \flatquad { O{oucblue} m m m m }{{%
\flcolcount{#1}%
\flpick{#1}{1}\xdef\flcA{\flcur}%
\flpick{#1}{2}\xdef\flcB{\flcur}%
\flpick{#1}{3}\xdef\flcC{\flcur}%
\flpick{#1}{4}\xdef\flcD{\flcur}%
\begin{tikzpicture}
\node[flblkl, fill=\flcA!8!white, text=\flcA!55!black, text width=4.5cm,
minimum height=34pt] (q1) at (0,0) {#2};
\node[flblkl, fill=\flcB!14!white, text=\flcB!55!black, text width=4.5cm,
minimum height=34pt, right=3pt of q1] (q2) {#3};
\node[flblkl, fill=\flcC!14!white, text=\flcC!55!black, text width=4.5cm,
minimum height=34pt, below=3pt of q1] (q3) {#4};
\node[flblkl, fill=\flcD!8!white, text=\flcD!55!black, text width=4.5cm,
minimum height=34pt, right=3pt of q3] (q4) {#5};
\end{tikzpicture}%
}}
%% ================== 8. 金字塔 ==================
%% \flatpyramid[颜色列表]{顶层, 第二层, ...} (按书写顺序自上而下)
%%
%% 说明:这里**不用** tikz 的 trapezium 形状。原因是它在给定 minimum width
%% 时会同时撑开上边和下边,结果上下边等宽、整体平移 —— 画出来是「平行四边形」
%% 而不是梯形。改为用显式坐标自绘:每一层的上/下宽度沿同一条斜线连续变化,
%% 因此整体是一个真正的金字塔。
\NewDocumentCommand \flatpyramid { O{oucblue} m }{{%
\flcheckitems{#2}\flcolcount{#1}\flcount{#2}%
\begin{tikzpicture}[x=1cm, y=1cm]
%% ---- 形状参数(要改金字塔的胖瘦/高矮,只动这三个数)----
\pgfmathsetmacro{\flpw}{0.75} % 顶层上边的「半宽」(cm);越大顶越平
\pgfmathsetmacro{\flbw}{3.30} % 底层下边的「半宽」(cm);越大底越宽
\pgfmathsetmacro{\fllyh}{0.55} % 每层高度 (cm)
\pgfmathsetmacro{\flgapy}{0.035}% 层间空隙 (cm),让各层分得清
%% ----------------------------------------------------
\pgfmathsetmacro{\flH}{\flcntval*\fllyh}
\foreach \flx [count=\fli] in {#2} {
\flpick{#1}{\fli}%
\pgfmathsetmacro{\flt}{(\fli-1)*\fllyh} % 该层上沿相对高度
\pgfmathsetmacro{\flb}{\fli*\fllyh} % 该层下沿相对高度
%% 半宽沿斜线线性变化:顶端 \flpw → 底端 \flbw
\pgfmathsetmacro{\flwt}{\flpw+(\flbw-\flpw)*(\flt/\flH)}
\pgfmathsetmacro{\flwb}{\flpw+(\flbw-\flpw)*(\flb/\flH)}
\pgfmathsetmacro{\flya}{-\flt} % 上沿 y(向下为负)
\pgfmathsetmacro{\flyb}{-\flb+\flgapy} % 下沿 y(留出空隙)
%% 真正的梯形:上边窄、下边宽
\fill[\flcur]
(-\flwt,\flya) -- (\flwt,\flya)
-- (\flwb,\flyb) -- (-\flwb,\flyb) -- cycle;
\pgfmathsetmacro{\flmid}{(\flya+\flyb)/2}
\node[text=white, font=\footnotesize, inner sep=1pt, align=center]
at (0,\flmid) {\flx};
}%
\end{tikzpicture}%
}}
%% ================== 9. 左右对比 ==================
%% \flatcompare[左色][右色]{左标题}{左内容}{右标题}{右内容}
\NewDocumentCommand \flatcompare { O{oucblue} O{oucamber} m m m m }{{%
\begin{tikzpicture}
\node[flblk, fill=#1, minimum width=4.7cm, minimum height=19pt] (h1) at (0,0) {#3};
\node[flblk, fill=#2, minimum width=4.7cm, minimum height=19pt,
right=8pt of h1] (h2) {#5};
\node[flblkl, fill=#1!7!white, text=#1!55!black, text width=4.5cm,
minimum height=54pt, below=3pt of h1] {#4};
\node[flblkl, fill=#2!7!white, text=#2!55!black, text width=4.5cm,
minimum height=54pt, below=3pt of h2] {#6};
\end{tikzpicture}%
}}
+245 -1
View File
@@ -183,19 +183,263 @@
\setbeamertemplate{frametitle}[frame]
}
%% ======================================================================
%% 目录页:自适应方框样式
%% ----------------------------------------------------------------------
%% 把每一个一级标题(\section)放进一个方框里。方框的高度、以及方框内
%% 文字的字号,都会根据一级标题的数目自动计算,并自动均分填满整页。
%%
%% 可调参数(在导言区用 \setlength 覆盖即可):
%% \tocareamargin 目录区上下预留的高度(自动模式下 =
%% \textheight 减去页眉页脚,默认 52pt)
%% \tocareaheight 直接指定目录区高度;设为 0pt(默认)表示自动
%% \tocboxgap 方框之间的理想间距(空间紧张时会自动压缩)
%% \tocboxgapmin 方框之间允许的最小间距
%% \tocboxmaxheight 单个方框的最大高度
%% \tocfontmax 方框内文字的最大字号
%% \tocfontwarn 字号低于该值时会给出警告(提示章节太多)
%%
%% 方框样式(在导言区用 \settocstyle{...} 选择):
%% box 浅色底 + 圆角框 + 圆形序号(默认)
%% solid 实心色底 + 白色文字
%% bar 白底 + 左侧粗色条
%%
%% 配色主题(在导言区用 \toctheme{...} 选择):
%% red 海大红(默认),与各章节标题页的颜色一致
%% blue 海大蓝,与目录页上「目录」二字的颜色一致
%% ======================================================================
\newlength{\tocareamargin}
\setlength{\tocareamargin}{52pt}
\newlength{\tocareaheight}
\setlength{\tocareaheight}{\z@}
\newlength{\tocboxgap}
\setlength{\tocboxgap}{10pt}
\newlength{\tocboxgapmin}
\setlength{\tocboxgapmin}{2pt}
\newlength{\tocboxmaxheight}
\setlength{\tocboxmaxheight}{110pt}
\newlength{\tocboxleftpad}
\setlength{\tocboxleftpad}{2.5pt}
\newlength{\tocfontmax}
\setlength{\tocfontmax}{26pt}
\newlength{\tocfontwarn}
\setlength{\tocfontwarn}{8pt}
\makeatletter
\newcount\ouc@toc@count
\newlength\ouc@toc@avail
\newlength\ouc@toc@gap
\newlength\ouc@toc@height
\newlength\ouc@toc@font
\newlength\ouc@toc@base
\newlength\ouc@toc@pad
\newlength\ouc@toc@padx
\newlength\ouc@toc@badgesize
\newlength\ouc@toc@tmp
\def\ouc@toc@style{box}
\newcommand{\settocstyle}[1]{\def\ouc@toc@style{#1}}
%% 配色主题:red = 海大红(默认,与章节标题页同色)
%% blue = 海大蓝(与目录页标题「目录」同色)
\def\ouc@toc@theme{red}
\newcommand{\toctheme}[1]{%
\def\ouc@toc@theme{#1}%
\ifcsname ouc@toc@setcolors@#1\endcsname
\csname ouc@toc@setcolors@#1\endcsname
\else
\PackageWarning{oucslide}{未知的目录页配色 “#1”,
可选值为 red / blue,这里按 red 处理}%
\ouc@toc@setcolors@red
\fi
}
%% 红色主题:主色 oucred,浅底 oucred10
\def\ouc@toc@setcolors@red{%
\def\ouc@toc@main{oucred}%
\def\ouc@toc@light{oucred10}%
}
%% 蓝色主题:主色 oucblue,浅底 oucblue10
\def\ouc@toc@setcolors@blue{%
\def\ouc@toc@main{oucblue}%
\def\ouc@toc@light{oucblue10}%
}
\ouc@toc@setcolors@red
%% 左对齐时给文字留出的左内边距
\def\ouc@toc@indent{\dimexpr\tocboxleftpad\relax}
\long\def\ouc@toc@gobblevi#1#2#3#4#5#6{}
\long\def\ouc@toc@gobblevii#1#2#3#4#5#6#7{}
%% 方框内文字的字体(字号由 \ouc@toc@compute 算出)
\def\ouc@toc@fontsel{\fontsize{\ouc@toc@font}{\ouc@toc@base}\selectfont\bfseries}
%% 圆形序号徽标(#1 = 圆圈填充色,#2 = 数字)
%% 注意:这里刻意不加 \strut。\strut 会把内容盒撑成「0.7 倍行距的上高 + 0.3 倍行距的下深」,
%% 而数字没有下伸部(descender),那段虚构的下深会把数字整体推高,在圆里明显偏上
%% (实测偏上约 1.7pt,大字号时可达 4pt)。去掉 \strut 后数字墨迹与圆心对齐(实测偏差 < 0.1pt)。
%% 圆的垂直位置不受影响:圆心到基线的距离恒为 minimum size 的一半(0.6em)。
\def\ouc@toc@badge#1#2{%
\tikz[baseline=(ouc@badge.base)]{%
\node[circle, fill=#1, text=white, inner sep=0pt,
minimum size=\ouc@toc@badgesize, font=\bfseries] (ouc@badge) {#2};%
}%
}
%% 实心样式下用的空心序号(#1 = 描边色,#2 = 数字;同样不加 \strut)
\def\ouc@toc@badgeopen#1#2{%
\tikz[baseline=(ouc@badge.base)]{%
\node[circle, draw=#1, line width=0.8pt, text=#1, inner sep=0pt,
minimum size=\ouc@toc@badgesize, font=\bfseries] (ouc@badge) {#2};%
}%
}
%% ---------------------------------------------------------------- 计数
%% 读入上一次编译生成的 .toc 文件,数出一共有多少个一级标题
\def\ouc@toc@countsections{%
\global\ouc@toc@count\z@
\begingroup
\makeatletter
\def\beamer@sectionintoc##1##2##3##4##5{\global\advance\ouc@toc@count\@ne}%
\let\beamer@subsectionintoc\ouc@toc@gobblevi
\let\beamer@subsubsectionintoc\ouc@toc@gobblevii
\@input{\jobname.toc}%
\makeatother
\endgroup
}
%% ------------------------------------------------------------ 计算尺寸
\def\ouc@toc@compute{%
%% 1. 目录区可用高度
\ifdim\tocareaheight=\z@
\setlength{\ouc@toc@avail}{\dimexpr\textheight-\tocareamargin\relax}%
\else
\setlength{\ouc@toc@avail}{\tocareaheight}%
\fi
\ifnum\ouc@toc@count<\@ne \global\ouc@toc@count\@ne \fi
%% 2. 间距:理想值 \tocboxgap;空间紧张时压缩,但不小于 \tocboxgapmin
\setlength{\ouc@toc@gap}{\tocboxgap}%
\setlength{\ouc@toc@tmp}{%
\dimexpr\ouc@toc@avail/(\ouc@toc@count+1)*25/100\relax}%
\ifdim\ouc@toc@gap>\ouc@toc@tmp \setlength{\ouc@toc@gap}{\ouc@toc@tmp}\fi
\ifdim\ouc@toc@gap<\tocboxgapmin \setlength{\ouc@toc@gap}{\tocboxgapmin}\fi
%% 3. 方框高度:扣掉 N+1 个间距后,把目录区高度均分给 N 个方框
\setlength{\ouc@toc@height}{%
\dimexpr(\ouc@toc@avail-\ouc@toc@count\ouc@toc@gap-\ouc@toc@gap)
/\ouc@toc@count\relax}%
\ifdim\ouc@toc@height>\tocboxmaxheight
\setlength{\ouc@toc@height}{\tocboxmaxheight}\fi
\ifdim\ouc@toc@height<8pt \setlength{\ouc@toc@height}{8pt}\fi
%% 4. 字号:随方框高度等比缩放,同时保证文字不会撑破方框
%% 内边距也随方框高度缩小,避免方框过矮时被 tcolorbox 撑回去
\setlength{\ouc@toc@pad}{\dimexpr\ouc@toc@height*12/100\relax}%
\ifdim\ouc@toc@pad>2pt \setlength{\ouc@toc@pad}{2pt}\fi
\setlength{\ouc@toc@padx}{\dimexpr\ouc@toc@pad*3\relax}%
\ifdim\ouc@toc@padx<6pt \setlength{\ouc@toc@padx}{6pt}\fi
\setlength{\ouc@toc@font}{\dimexpr\ouc@toc@height*40/100\relax}%
\setlength{\ouc@toc@tmp}{%
\dimexpr(\ouc@toc@height-2\ouc@toc@pad-2pt)*5/6\relax}%
\ifdim\ouc@toc@font>\ouc@toc@tmp \setlength{\ouc@toc@font}{\ouc@toc@tmp}\fi
\ifdim\ouc@toc@font>\tocfontmax \setlength{\ouc@toc@font}{\tocfontmax}\fi
\ifdim\ouc@toc@font<\tocfontwarn
\PackageWarning{oucslide}{目录页有 \the\ouc@toc@count\space 个一级标题,
字号已被压缩到 \the\ouc@toc@font(低于 \the\tocfontwarn)。
如观感不佳,请减少 section 的数目,或调小 \string\tocareamargin}%
\fi
\setlength{\ouc@toc@base}{\dimexpr\ouc@toc@font*6/5\relax}%
%% 5. 序号徽标直径:随字号一起缩放,但不能超过方框高度,否则会把矮方框撑破。
%% 注意:必须在算完 \ouc@toc@font 之后再算,否则读到的还是 0。
\setlength{\ouc@toc@badgesize}{\dimexpr\ouc@toc@font*115/100\relax}%
\setlength{\ouc@toc@tmp}{\dimexpr\ouc@toc@height-2pt\relax}%
\ifdim\ouc@toc@badgesize>\ouc@toc@tmp \setlength{\ouc@toc@badgesize}{\ouc@toc@tmp}\fi
\ifdim\ouc@toc@badgesize<4pt \setlength{\ouc@toc@badgesize}{4pt}\fi
}
%% -------------------------------------------------------------- 条目
%% #1 = 序号, #2 = 标题, #3 = 锚点页码
\def\ouc@toc@entry#1#2#3{%
\ifcsname ouc@toc@entry@\ouc@toc@style\endcsname
\csname ouc@toc@entry@\ouc@toc@style\endcsname{#1}{#2}{#3}%
\else
\PackageWarning{oucslide}{未知的目录页样式 “\ouc@toc@style”,
可选值为 box / solid / bar,这里按 box 处理}%
\ouc@toc@entry@box{#1}{#2}{#3}%
\fi
}
%% 样式 box:浅色底 + 圆角框 + 圆形序号,文字左对齐(左侧留白)
\def\ouc@toc@entry@box#1#2#3{%
\begin{tcolorbox}[width=\textwidth, height=\ouc@toc@height,
valign=center, halign=left, arc=3pt, boxrule=0.8pt,
colframe=\ouc@toc@main, colback=\ouc@toc@light, coltext=\ouc@toc@main,
left=\ouc@toc@indent, right=\ouc@toc@padx, top=\ouc@toc@pad, bottom=\ouc@toc@pad,
boxsep=0pt, before skip=0pt, after skip=0pt,
fontupper=\ouc@toc@fontsel]%
\ouc@toc@badge{\ouc@toc@main}{#1}%
\hspace{0.8em}\hyperlink{Navigation#3}{#2}%
\end{tcolorbox}%
}
%% 样式 solid:实心色底 + 白字,文字左对齐(左侧留白)
\def\ouc@toc@entry@solid#1#2#3{%
\begin{tcolorbox}[width=\textwidth, height=\ouc@toc@height,
valign=center, halign=left, arc=3pt, boxrule=0pt,
colframe=\ouc@toc@main, colback=\ouc@toc@main, coltext=white,
left=\ouc@toc@indent, right=\ouc@toc@padx, top=\ouc@toc@pad, bottom=\ouc@toc@pad,
boxsep=0pt, before skip=0pt, after skip=0pt,
fontupper=\ouc@toc@fontsel]%
\ouc@toc@badgeopen{white}{#1}%
\hspace{0.8em}\hyperlink{Navigation#3}{#2}%
\end{tcolorbox}%
}
%% 样式 bar:白底 + 左侧粗色条 + 圆形序号,文字左对齐(左侧留白)
\def\ouc@toc@entry@bar#1#2#3{%
\begin{tcolorbox}[width=\textwidth, height=\ouc@toc@height,
valign=center, halign=left, arc=0pt, boxrule=0.5pt,
leftrule=8pt, colframe=\ouc@toc@main, colback=white, coltext=black,
left=\ouc@toc@indent, right=\ouc@toc@padx, top=\ouc@toc@pad, bottom=\ouc@toc@pad,
boxsep=0pt, before skip=0pt, after skip=0pt,
fontupper=\ouc@toc@fontsel]%
\ouc@toc@badge{\ouc@toc@main}{#1}%
\hspace{0.8em}\hyperlink{Navigation#3}{#2}%
\end{tcolorbox}%
}
%% ---------------------------------------------------------- 目录页正文
%% 逐条读入 .toc,把每个一级标题渲染成一个方框;
%% 方框之间、方框与页面上下边缘之间各放一个 \vfill,
%% 由 beamer 自动等分剩余空间,从而刚好铺满整页。
\def\ouc@toc@body{%
\ouc@toc@countsections
\ouc@toc@compute
\begingroup
\makeatletter
\let\beamer@subsectionintoc\ouc@toc@gobblevi
\let\beamer@subsubsectionintoc\ouc@toc@gobblevii
\def\beamer@sectionintoc##1##2##3##4##5{%
\vfill\ouc@toc@entry{##5}{##2}{##3}%
}%
\@input{\jobname.toc}%
\makeatother
\vfill
\endgroup
}
%定义目录页生成命令
\def\makeoutline{
{
\setbeamertemplate{frametitle}[outlineframe]
\begin{frame}
\frametitle{目录}
\tableofcontents[hideallsubsections]
\ouc@toc@body
\end{frame}
}
%再把模板改回去
\setbeamertemplate{frametitle}[frame]
}
\makeatother
%定义最后一页生成命令
\def\makelast{