所有模板目录改为中文名,并入幻灯片与科技报告两个仓库(#3)

目录改名(git mv 保留历史,包名不变):
  exam/   -> 试卷/
  form/   -> 年度考核登记表/
  form2/  -> 劳务发放说明表/
  course/ -> 课程执行大纲/

改名即可编译:实测 6 个模板在含中文的目录下 XeLaTeX 均零报错,
PDF 逐页文本与改名前的版本完全一致(0 页差异,仅元数据时间戳变化)。

并入两个此前独立维护的仓库:
  ouc-slide-latex-template  -> 幻灯片/
  ouc-report-latex-template -> 科技报告/
带入了 theme/ fonts/ logos/ figs/ cls/ input/ 与 fontawesome.pdf,
字体随模板附带(无须在系统安装)。中间文件一律不入库。

同步修正的文档:根 README 目录表改为中文名并说明统一维护;
四个子 README 的标题;ouclw.sty 注释里对 form/ 的交叉引用;
幻灯片与科技报告 README 里「从旧仓库 clone」「按年份切分支」等已失效的说明
(并入后只有 main 一个分支,各年份 TeX Live 通用)。

两个迁入模板的 PDF 保留源仓库原版(逐字节一致),未重新编译:
源 PDF 出自 TeX Live 2026,本机为 2022,重新编译会让结尾页装饰层定位
产生细微偏移,保留原版以保证样张与原来完全一致。
This commit is contained in:
2026-10-26 18:31:04 +08:00
parent 6584dfac88
commit 1f807e9cce
106 changed files with 3435 additions and 16 deletions
+28 -10
View File
@@ -1,19 +1,37 @@
# ouc_latex_template
中国海洋大学各类文件 LaTeX 模板。
中国海洋大学各类文件 LaTeX 模板。**本仓库是本项目唯一的模板维护库**,各模板按文档类别分目录存放,互不依赖、可单独编译。
## 目录
| 目录 | 内容 |
|---|---|
| [`exam/`](exam/) | 期末考试**试卷**与**参考答案及评分标准**模板(XeLaTeX) |
| [`form/`](form/) | 教职工**年度考核登记表**模板(XeLaTeX) |
| [`form2/`](form2/) | **劳务发放说明表**模板(XeLaTeX) |
| [`course/`](course/) | 本科**课程教学执行大纲、教学日历**模板(XeLaTeX) |
| 目录 | 内容 | 编译入口 |
|---|---|---|
| [`试卷/`](试卷/) | 期末考试**试卷**、**参考答案及评分标准**两套模板 | `试卷题型示例.tex`、`参考答案与评分标准示例.tex` |
| [`年度考核登记表/`](年度考核登记表/) | 教职工**年度考核登记表** | `年度考核登记表.tex` |
| [`劳务发放说明表/`](劳务发放说明表/) | **劳务发放说明表** | `劳务发放说明表.tex` |
| [`课程执行大纲/`](课程执行大纲/) | 本科**课程教学执行大纲、教学日历** | `课程执行大纲.tex` |
| [`幻灯片/`](幻灯片/) | 演示文稿(**beamer** 主题,海大配色) | `slides.tex` |
| [`科技报告/`](科技报告/) | **科技报告**、实验讲义、说明文档 | `report.tex` |
## 编译
全部模板都**必须用 XeLaTeX**(fontspec + xeCJK),pdflatex 编译不过:
```bash
cd 幻灯片
xelatex slides.tex
xelatex slides.tex # 跑两遍,第二遍才能取到正确的目录、交叉引用与总页数
```
目录名含中文不影响编译(已实测 6 个模板在中文目录下零报错编译通过)。
## 说明
本仓库下每个子目录是一类文档的独立模板,各自自包含、可单独编译。
子目录内的 `README.md` 写明该模板的用法、参数与书写注意事项。
- **每个子目录自包含**:样式文件(`.sty` / `.cls`)、字体、图片都在各目录内,编译时不需要额外的宏包搜索路径。
- **字体随模板附带**:`幻灯片/fonts/`(鸿蒙 HarmonyOS Sans)、`科技报告/font/`(鸿蒙 + 方正系列)内置了字体文件,**无需在系统里安装字体**。其余四个模板用系统自带的宋体 / 黑体 / 仿宋 / Times New Roman,缺失时按各目录 README 的降级表替换。
- **各目录的 `README.md`** 写明该模板的用法、可改参数、版式数据来源与书写注意事项,改之前先看。
- **示例内容为占位**:模板均不含真题、不含真人信息,姓名 / 学号 / 职工号 / 课程代码等一律用 `×` 或虚构值占位,按实际情况替换即可。
模板均不含真题,示例内容为占位,按实际课程替换即可。
## 历史沿革
`幻灯片/` 与 `科技报告/` 此前分别维护在两个独立仓库(`ouc-slide-latex-template`、`ouc-report-latex-template`),2026-10 起**并入本仓库统一维护**,两个旧仓库不再更新。迁入时保留了原有目录结构、字体与图片资源,旧仓库的提交历史留在原仓库中。
@@ -1,4 +1,4 @@
# form2/ — 中国海洋大学 劳务发放说明表(LaTeX 版)
# 劳务发放说明表 — 中国海洋大学 劳务发放说明表(LaTeX 版)
把实验室用的《劳务发放说明表》Word 版复刻为 LaTeX 模板。版式与原 `.docx`
逐项对齐,**不含任何真人信息**:姓名、人数、项目名称、单位名称一律 `×` 占位。
@@ -116,7 +116,7 @@
% R3 c1-c2(span 2)| c3 | c4
%
%----------------------------------------------------------------------
% ⚠️ 本表与年度考核表(form/)的关键差别:**可以用 colsep 真实还原内边距**。
% ⚠️ 本表与年度考核表(年度考核登记表/)的关键差别:**可以用 colsep 真实还原内边距**。
%
% docx 的 tblCellMar 是 top/bottom = 0、left/right = 108 twips(1.905 mm)。
% 年度考核表里有个只有 1.41 mm 宽的 c10,比两倍内边距还窄,所以只能取
@@ -138,7 +138,7 @@
% “Table width is too small, need 0.45pt more!” 外加一条 Overfull \hbox。
%
%----------------------------------------------------------------------
% ⚠️ 两条通用结论(在 form/ 里踩过,这里同样适用):
% ⚠️ 两条通用结论(在 年度考核登记表/ 里踩过,这里同样适用):
%
% (a) 合并单元格 cell{r}{c}={c=n}{c} 的单元类型 {c} 是【不折行的 LR 模式】。
% 格内文字若比所跨各列合计更宽,它不会在列内折行,而是【把这些列撑宽】,
@@ -1,4 +1,4 @@
# form/ — 中国海洋大学 教职工年度考核登记表(LaTeX 版)
# 年度考核登记表 — 中国海洋大学 教职工年度考核登记表(LaTeX 版)
把学校下发的 Word 版《中国海洋大学教职工年度考核登记表》复刻为 LaTeX 模板,
版式与原 `.docx` 逐项对齐,**表格里不含任何真人信息**(姓名/职工号/出生年月/
+29
View File
@@ -0,0 +1,29 @@
BSD 3-Clause License
Copyright (c) 2020, Helmholtz AI Energy
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+361
View File
@@ -0,0 +1,361 @@
# 中国海洋大学幻灯片LaTex模板
中国海洋大学幻灯片LaTex非官方模板。
本模板修改自<a href="https://github.com/Helmholtz-AI-Energy/beamer-template" target="_blank">HelmholtzAI</a>模板。在原有模板基础上进行了大量修改。
模板主要使用海大公布的标准色,包括海大蓝、海大天蓝、海大红、樱缤粉、文脉棕、专金、专银,以及后加的苍松绿、暮山紫、琥珀橙。
此外,使用了大量的信息框来增加模板的活力。
> 本目录原为独立仓库 `ouc-slide-latex-template`,2026-10 起并入 `ouc_latex_template` 统一维护,旧仓库不再更新。
# 文件结构
模板中的文件主要包括:
1. slides.tex:主文件,编写的演示文稿内容主要存放在该文件当中。
2. oucslide.sty:模板的样式文件。
3. fonts:字体文件夹,所有编译需要用到的字体。默认字体使用的是华为鸿蒙字体。
4. theme:主题文件夹。
1. beamercolorthemeOUCSlide.sty:颜色定义文件。
2. beamerfontthemeOUCSlide.sty:字体定义文件。
3. beamerinnerthemeOUCSlide.sty:内部元素定义文件。
4. beamerouterthemeOUCSlide.sty:整体布局定义文件。
5. beamerthemeOUCSlide.sty:主题定义文件。
5. logos:模板中使用的Logo存放文件夹。
6. figs:插入的图片文件夹。
7. fontawesome.pdf:图标使用说明文件。
# 使用方法
1. 本模板现为 `ouc_latex_template` 仓库的 `幻灯片/` 子目录,克隆主仓库即可:
```bash
git clone https://code.yangyq.net/laoyang/ouc_latex_template.git
cd ouc_latex_template/幻灯片
```
子目录内自包含(`theme/`、`fonts/`、`logos/`、`figs/` 都在本目录),不需要额外的宏包搜索路径。
2. 安装Tex编译器,推荐使用<a href="https://tug.org/texlive/" target="_blank">TexLive</a>,安装成功后,可以使用自带的TeXworks打开目录下的tex文件进行编译。
3. 可以安装其他的IDE工具进行Tex文件的编写和修改,推荐使用<a href="https://code.visualstudio.com/" target="_blank">Visual Studio Code</a>。
4. 编译时,请选择XeLaTex,有时候,可能需要连续编译两次,以得到正确的页码和图表编号。
# 编译器版本兼容性
模板已内置**版本自动判别**,同一份源码在 TeX Live 2022 及以后各年份均可直接编译,**不需要改代码、也不需要切分支**。
| TeX Live | beamer 版本 | 状态 |
|------|-------------|------|
| 2022 | 3.66 | 已验证通过(本机实测,30 页) |
| 2023 | 3.69 | 已验证通过 |
| 2024 | 3.71 | 已验证通过 |
| 2025 | 3.72 | 已验证通过 |
| 2026 | 3.77 | 已验证通过 |
> 低于 TeX Live 2022 的版本未做验证,不保证可用。
## 为什么需要版本判别
beamer 的内部实现会随 TeX Live 版本变化,而模板中对内部宏的补丁(`\patchcmd`)会因此失效。最典型的一次是:
- **beamer 3.69(TeX Live 2023)** 起,`\beamer@@frametitle` 改用 `\beamer@insertframetitlecontinuation`,使得面向旧版写法的补丁匹配失败,报 `Patching original frame title failed`。
- 模板现已加入**版本自动判别**(依据 `\beamer@insertframetitlecontinuation` 是否存在,判断逻辑写在文件顶层 `theme/beamerfontthemeOUCSlide.sty`),因此各年份**不需要再改动源码**。
- 若将来 beamer 再次改动内部实现,按同样思路在该文件顶层加判别分支即可。
## 关于 `slides.pdf`
仓库内的 `slides.pdf` 是成品样张,用于预览效果。它由**较新版本**的 TeX Live 编译;用本机较旧版本重新编译时,个别页面的装饰层定位可能有细微差别(例如结尾页右下角的网址位置),**正文内容与版式一致性不受影响**。
## 维护约定
每当有新的 TeX Live 年份发布时:
1. 在新版本的 TeX Live 下,用 **XeLaTeX 编译本目录的 `slides.tex`**;
2. 如果编译不通过,修改 `theme/beamerfontthemeOUCSlide.sty` 顶层的版本判别分支,注意保持向后兼容(不要让新年份的改动破坏旧年份);
3. 在兼容性表格里补一行,注明已验证通过的版本。
# 元素介绍
## 基本信息
Tex文件的开头,是基本信息部分,可以根据需要添加`\title`{标题}、`\subtitle`{子标题}、`\author`{作者}、`\date`{\today}、`\institute`{所属机构}。
`\newcommand{\last}{敬请批评指正!}` 的作用是为了制作最后一页致谢页面而单独设置的,可以修改为任何致谢语句。
## 特殊页面
模板中有三个特殊的页面,分别是:标题页(首页)、目录页和结尾页。这三个页面由于其特殊性,不能使用frame的常规模板,因此,为它们创建了三个命令进行生成:
```
\maketitle
\makeoutline
\makelast
```
使用者三个命令后,将会自动创建首页、目录页和结尾页。
首页和结尾页,使用的是基本信息中的数据,而目录页的内容,将根据`\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` 中)。
## 使用分节
本模板使用分节进行整体规划,章节共三级,对应的关键字分别是:
```
\section
\subsection
\subsubsection
```
其中,`\section` 会有单独的页面进行显示。如下图所示。而且,section还将会出现在目录页面中。
![section](/figs/fig01.png )
`\subsection` 和 `\subsubsection`都没有单独的页面相对应,他们会出现在对应章节的frame中,作为标题进行呈现,并且加入了自动编号的效果。需要说明的是,`\subsection`是必须的,而 `\subsubsection` 却可有可无。他们呈现出的最终的效果,如下图所示。
![subsection](/figs/fig02.png)
**需要注意的是,虽然frame的标题,是由subsection和subsubsection自动生成的,但是frame中的frametitle仍然是必须的,否则没有frametitle这个元素,标题无法自动填充。**
## 使用Frame
章节确定好后,就可以增加Frame来编写幻灯片。使用代码:
```
\begin{frame}
\frametitle{测试}
\end{frame}
```
就可以插入一张幻灯片。
需要注意的是:如果幻灯片中使用了代码块,则需要加入关键字`fragile`。这样,引入的代码才能保持它们原有的样子,如下所示:
```
\begin{frame}[fragile]
\frametitle{测试}
\end{frame}
```
当然,也可以使用定义的特殊的frame模板来达到这种效果。
```
\begin{fragileframe}
\frametitle{测试}
\end{fragileframe}
```
他们的效果是一样的。
## 字体
模板使用的默认字体是<a href="https://developer.harmonyos.com/cn/docs/design/font-0000001157868583" target="_blank">华为鸿蒙字体 (HarmonyOS Sans)</a>。该字体可以免费商用。
如果对字体不满意,可下载其他字体,放入fonts文件夹,并在`beamerfontthemeOUCSlide.sty`文件中修改。
推荐的字体包括:<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 | 专银 | 海大标准色 |
| 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个等级。
## 信息框
信息框使用边框的形式,提升幻灯片的表现力。
主要的信息框包括:列表框(`vcolorbox`)、提示框(`notebox`、`importantbox`)、信息框(`titlebox`)、要点框(`pointbox`)、块(`block`、`exampleblock`、`alertblock`)、标题框(`headbox`)和文本框(`textbox`)。它们的效果,如下图所示。
![列表框](/figs/fig03.png)
![提示框](/figs/fig04.png)
![信息框](/figs/fig05.png)
![要点框](/figs/fig06.png)
![块](/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`即可。
## 公式
模板中可以直接插入公式,和LaTex中没有什么区别。
## 脚注
可以在任何地方使用脚注。即便是在各种信息框中也可以。
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

+21
View File
@@ -0,0 +1,21 @@
%!TEX program = xelatex
%% 版本:1.0
%% 2022-05-07
%% 作者:杨永全
%% 本文件的主要作用,是为了定义基本结构
%原模板代码
\makeatletter
\def\beamer@calltheme#1#2#3{%
\def\beamer@themelist{#2}
\@for\beamer@themename:=\beamer@themelist\do
{\usepackage[{#1}]{\beamer@themelocation/#3\beamer@themename}}}
\def\usefolder#1{
\def\beamer@themelocation{#1}
}
\def\beamer@themelocation{}
\usefolder{theme}
\usetheme{OUCSlide}
Binary file not shown.
+471
View File
@@ -0,0 +1,471 @@
%!TEX program = xelatex
%% 版本:1.0
%% 2022-05-07
%% 作者:杨永全
\documentclass[aspectratio=169,UTF8,t]{beamer}%比例是16:9,UTF8编码支持,顶部对齐
\usepackage{oucslide}
\usepackage[UTF8]{ctex}
\usepackage{xeCJK}
\usepackage{fontawesome}%加入图标支持
\usepackage{tcolorbox}
\usepackage{verbatim}
\usepackage{caption}
\usepackage{subcaption}
\newcommand\crule[3][black]{\textcolor{#1}{\rule{#2}{#3}}}
%基本信息
\title{中国海洋大学幻灯片LaTex模板}
\subtitle{助力你的科研梦想}
\author{杨永全}
\date{\today}
\institute{计算机科学与技术学院}
\newcommand{\last}{敬请批评指正!} %结束语
%\newcommand{\last}{提问与解答环节}
%基本信息结束
\begin{document}
\maketitle
\makeoutline
\section{简介}
\subsection{模板简介}
\begin{frame}
\frametitle{简介}
中国海洋大学演示文稿LaTex非官方模板。
本模板修改自HelmholtzAI\footnote{https://github.com/Helmholtz-AI-Energy/beamer-template}模板。在原有模板基础上进行了大量修改。
模板主要使用海大公布的标准色,包括海大蓝、海大天蓝、海大红、樱缤粉、文脉棕、专金、专银。
此外,使用了大量的信息框来增加模板的活力。
\begin{center}
\begin{figure}
\centering
\includegraphics[width=0.6\textwidth]{figs/ouc.png}
\caption{中国海洋大学}
\label{fig:ouc}
\end{figure}
\end{center}
\end{frame}
\section{模板使用方法}
\subsection{使用方法}
\begin{frame}
\frametitle{模板使用方法}
\begin{enumerate}
\item 从git上clone整个文件夹目录\footnote{https://git.yangyq.net/laoyang/ouc-slide-latex-template.git }\footnote{https://github.com/dryangyq/ouc-slide-latex-template.git}\footnote{https://gitee.com/dryangyq/ouc-slide-latex-template.git}\footnote{https://gitlab.com/dryangyq/ouc-slide-latex-template.git}\\~
\item 编辑tex文件进行修改\\~
\item 编译tex文件为PDF\\~
\begin{enumerate}
\item 可以使用VS Code,或者\\~
\item 使用LaTeX IDE,比如TeXstudio等进行编译\\~
\end{enumerate}
\item \emph{注意:} 请使用LuaLaTeX 或者 XeLaTeX 进行编译
\end{enumerate}
\end{frame}
\section{元素}
\subsection{字体}
\begin{frame}
\frametitle{字体是啥}
模板使用的默认字体是鸿蒙字体。
如果对字体不满意,可下载其他字体,放入fonts文件夹,并在\textbf{beamerfontthemeOUCSlide.sty}文件中修改。
\begin{center}
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{figs/harmonysans.png}
\caption{鸿蒙字体}
\label{fig:harmonysans}
\end{figure}
\end{center}
\end{frame}
\subsection{颜色}
\subsubsection{基本颜色}
\begin{frame}
\frametitle{颜色}
%\framesubtitle{基本颜色}
根据海大公布的标准颜色,定义了相关颜色,主要包括海大蓝、海大天蓝、海大红、樱缤粉、文脉棕、专金、专银,以及后加的苍松绿、暮山紫、琥珀橙。其中文名称和代码如表\ref{table:color}所示。\\
当然,也可以使用LaTex自带的颜色,例如white、black等。
\begin{table}
\centering
\small
\caption{基本颜色定义}
\label{table:color}
\begin{tabular}{ccc}
\textbf{颜色} & \textbf{名称} & \textbf{中文名}\\\toprule
\crule[oucblue]{10pt}{10pt} & oucblue & 海大蓝 \\
\crule[ouclightblue]{10pt}{10pt} & ouclightblue & 海大天蓝 \\
\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}
\frametitle{颜色}
%\framesubtitle{颜色等级}
\emph{定义的海大标准色,每一种颜色,都有十个等级,等级越低,颜色越浅。例如:对于海大蓝,其等级颜色如表\ref{table:colorgrade}所示。}\\
\begin{table}
\centering
\small
\caption{颜色等级}
\label{table:colorgrade}
\begin{tabular}{cl}
\textbf{颜色} & \textbf{名称}\\\toprule
\crule[oucblue10]{8pt}{8pt} & oucblue10 \\
\crule[oucblue20]{8pt}{8pt} & oucblue20 \\
\crule[oucblue30]{8pt}{8pt} & oucblue30 \\
\crule[oucblue40]{8pt}{8pt} & oucblue40 \\
\crule[oucblue50]{8pt}{8pt} & oucblue50 \\
\crule[oucblue60]{8pt}{8pt} & oucblue60 \\
\crule[oucblue70]{8pt}{8pt} & oucblue70 \\
\crule[oucblue80]{8pt}{8pt} & oucblue80 \\
\crule[oucblue90]{8pt}{8pt} & oucblue90 \\
\crule[oucblue]{8pt}{8pt} & oucblue \\\bottomrule
\end{tabular}
\end{table}
\end{frame}
\subsection{副标题和列表}
\subsubsection{\textbf{副标题}:可以补充更多信息}
\begin{frame}
\frametitle{副标题和列表}
副标题,可以展示不同的层级关系,一般用来显示内部章节。\\
幻灯片的标题,都使用section进行规划,内部的frametitle中的内容将不再起作用。一级标题,使用单独的幻灯片进行展示,并显示在目录幻灯片中。二级和三级标题,在幻灯片的标题部分进行显示,带有自动编号。\\
可以使用内部列表展示幻灯片中的层级关系。这里是无序列表的样子。
\begin{itemize}
\item 这里展示一个列表
\item 列表可以是多级
\begin{itemize}
\item 这里是二级
\begin{itemize}
\item 这里是三级标题
\end{itemize}
\item 顺序是无所谓的
\end{itemize}
\end{itemize}
\end{frame}
\subsection{列表框}
\begin{frame}
\frametitle{列表框}
列表框一般用来展示列表内容,使用vcolorbox,可以使用自定义颜色。
\begin{vcolorbox}[中国海洋大学]{oucred}
1. 211、985重点高校
2. 世界一流大学建设高校(A类)。
\end{vcolorbox}
\begin{vcolorbox}[学校校训]{ouclightblue}
海纳百川,取则行远
\end{vcolorbox}
\begin{vcolorbox}[学校特色]{oucblue}
1. 海洋和水产学科特色显著
2. 学科门类齐全
\end{vcolorbox}
\end{frame}
\subsection{提示框}
\begin{frame}
\frametitle{提示框}
提示框共两类,一类是笔记提示框(notebox),一般用来提示学生记录笔记;另外一类是重要信息提示框(importantbox),默认使用红色,具有更强的视觉冲击力。
\begin{notebox}[笔记]
请大家把这里的笔记记录下来,是重点内容。
\end{notebox}
\begin{importantbox}[重要]
考试时禁止任何形式的作弊行为!
\end{importantbox}
\end{frame}
\subsection{信息框}
\begin{frame}
\frametitle{信息框}
信息框(titlebox)主要用来勾勒一些需要注意的信息,颜色可以自定义。
\begin{titlebox}[提示框]{oucred}
这里展示的是海大红颜色的提示框。
\end{titlebox}
\begin{titlebox}[颜色展示]{oucblue}
这里展示海大蓝的颜色。当然,可以使用更多的颜色。
\end{titlebox}
\begin{titlebox}[另外一些颜色的显示]{ouclightblue}
这里展示海大天蓝的颜色。当然,可以使用更多的颜色。
\end{titlebox}
\end{frame}
\subsection{要点框}
\begin{frame}
\frametitle{要点框}
要点框(pointbox)主要用来展示一些要点,需要和分栏配合使用,颜色可以自定义。 \\
高度可以写在参数中。
\begin{columns}
\begin{column}{0.3\textwidth}
\begin{pointbox}[要点一]{oucred}{100pt}
人文特色\\
海洋特色\\
\end{pointbox}
\end{column}
\begin{column}{0.3\textwidth}
\begin{pointbox}[要点二]{oucblue}{100pt}
211\\
985\\
双一流
\end{pointbox}
\end{column}
\begin{column}{0.3\textwidth}
\begin{pointbox}[要点三]{ouclightblue}{100pt}
院士\\
杰青
\end{pointbox}
\end{column}
\end{columns}
\end{frame}
\subsection{标题框和文本框}
\begin{frame}
\frametitle{文本框}
标题框和文本框配合使用,基本上可以满足大部分的内容展示需求。 \\
\begin{headbox}{oucred}
中国海洋大学
\end{headbox}
\begin{textbox}{oucblue}
中国海洋大学是一所海洋和水产学科特色显著、学科门类齐全的教育部直属重点综合性大学,是国家“985工程”和“211工程”重点建设的高校,2017年9月入选国家“世界一流大学建设高校”(A类)。
学校校训是“海纳百川,取则行远”。
\end{textbox}
\begin{textbox}{ouclightblue}
学校创建于1924年,历经私立青岛大学、国立青岛大学、国立山东大学、山东大学等办学时期,于1959年发展成为山东海洋学院,1960年被国家确定为全国13所重点综合性大学之一,1988年更名为青岛海洋大学,2002年更名为中国海洋大学。
\end{textbox}
\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}
\frametitle{块}
块(block)共分为三种,分别是默认、example和alert,颜色分别使用海大蓝、专银和海大红。
\begin{block}{默认块}
一个系统默认的块,是这样的。
\end{block}
\begin{exampleblock}{例子}
如果需要放入一些例子,可以用这个颜色的块。
\end{exampleblock}
\begin{alertblock}{提示块}
这里展示的是需要额外注意的信息。
\end{alertblock}
\end{frame}
\subsection{代码}
\begin{frame}[fragile]
\frametitle{代码}
请注意 [fragile] 这个关键字,是必须的。当然,也可使用定义好的另外一种frame,叫做fragileframe,他们的效果是一样的。该关键字的目的,是为了让代码保持它原有的样子。代码段的关键词是lstlisting。\\
当前显示的效果还比较一般,后续将加入更多的颜色主题。
\begin{lstlisting}[language=Java,caption={src/app/app.module.ts}]
import org.sun.com;
public class helloworld{
public static void main()
{
System.out.println("hello world!");
}
}
\end{lstlisting}
\end{frame}
\section{其他细节}
\subsection{公式}
\begin{frame}
\frametitle{公式}
支持LaTex原生的公式,当然也可以和文字进行混排。
\begin{equation}
f(x) = \sum_i wx_i^2 + \frac{\beta}{2} \label{eq:simple}
\end{equation}
这里可以进行文字的说明,如式\eqref{eq:simple}所示。
\end{frame}
\subsection{栏目和图}
\begin{frame}
\frametitle{栏目和图}
\begin{columns}
\begin{column}{0.4\textwidth}
\begin{enumerate}
\item 一个页面可以分为多栏\\~
\item 栏目的宽度,需要自己进行定义\\~
\item 可以导入图片\\~
\item 可以根据情况对图片进行缩放
\end{enumerate}
\end{column}
\begin{column}{0.4\textwidth}
\centering
\begin{figure}
\centering
\includegraphics[width=\textwidth]{figs/ouc_gate.png}
\caption{中国海洋大学校门}
\label{fig1}
\end{figure}
\end{column}
\end{columns}
\end{frame}
\subsection{脚注}
\begin{frame}
\frametitle{脚注}
可以在任何地方加入脚注,即便是在各种信息框\footnote{信息框包括:提示框、列表框、要点框等。}中也可以。
\begin{notebox}[笔记]
请大家把这里的笔记记录下来,是重点内容\footnote{考试要考。}。
\end{notebox}
\end{frame}
%最后一页
\makelast
\end{document}
@@ -0,0 +1,164 @@
%% 版本:1.0
%% 作者:杨永全
%% 本文件的主要作用,是为了定义海大标准颜色
%% 完成时间:2022-05-09
\RequirePackage{xcolor}
% OUC BLue 海大蓝 默认颜色
\definecolor{oucblue}{RGB}{0, 64, 152}
\colorlet{oucblue10}{oucblue!10!white}
\colorlet{oucblue20}{oucblue!20!white}
\colorlet{oucblue30}{oucblue!30!white}
\colorlet{oucblue40}{oucblue!40!white}
\colorlet{oucblue50}{oucblue!50!white}
\colorlet{oucblue60}{oucblue!60!white}
\colorlet{oucblue70}{oucblue!70!white}
\colorlet{oucblue80}{oucblue!80!white}
\colorlet{oucblue90}{oucblue!90!white}
% OUC Light Blue 海大天蓝
\definecolor{ouclightblue}{RGB}{0, 160, 233}
\colorlet{ouclightblue10}{ouclightblue!10!white}
\colorlet{ouclightblue20}{ouclightblue!20!white}
\colorlet{ouclightblue30}{ouclightblue!30!white}
\colorlet{ouclightblue40}{ouclightblue!40!white}
\colorlet{ouclightblue50}{ouclightblue!50!white}
\colorlet{ouclightblue60}{ouclightblue!60!white}
\colorlet{ouclightblue70}{ouclightblue!70!white}
\colorlet{ouclightblue80}{ouclightblue!80!white}
\colorlet{ouclightblue90}{ouclightblue!90!white}
% OUC Red 海大红
\definecolor{oucred}{RGB}{200, 21, 40}
\colorlet{oucred10}{oucred!10!white}
\colorlet{oucred20}{oucred!20!white}
\colorlet{oucred30}{oucred!30!white}
\colorlet{oucred40}{oucred!40!white}
\colorlet{oucred50}{oucred!50!white}
\colorlet{oucred60}{oucred!60!white}
\colorlet{oucred70}{oucred!70!white}
\colorlet{oucred80}{oucred!80!white}
\colorlet{oucred90}{oucred!90!white}
%OUC Cherry 樱缤粉
\definecolor{ouccherry}{RGB}{249, 210, 212}
\colorlet{ouccherry10}{ouccherry!10!white}
\colorlet{ouccherry20}{ouccherry!20!white}
\colorlet{ouccherry30}{ouccherry!30!white}
\colorlet{ouccherry40}{ouccherry!40!white}
\colorlet{ouccherry50}{ouccherry!50!white}
\colorlet{ouccherry60}{ouccherry!60!white}
\colorlet{ouccherry70}{ouccherry!70!white}
\colorlet{ouccherry80}{ouccherry!80!white}
\colorlet{ouccherry90}{ouccherry!90!white}
%OUC Brown 文脉棕
\definecolor{oucbrown}{RGB}{121, 79, 47}
\colorlet{oucbrown10}{oucbrown!10!white}
\colorlet{oucbrown20}{oucbrown!20!white}
\colorlet{oucbrown30}{oucbrown!30!white}
\colorlet{oucbrown40}{oucbrown!40!white}
\colorlet{oucbrown50}{oucbrown!50!white}
\colorlet{oucbrown60}{oucbrown!60!white}
\colorlet{oucbrown70}{oucbrown!70!white}
\colorlet{oucbrown80}{oucbrown!80!white}
\colorlet{oucbrown90}{oucbrown!90!white}
%OUC Golden 专金
\definecolor{oucgolden}{RGB}{204, 173, 105}
\colorlet{oucgolden10}{oucgolden!10!white}
\colorlet{oucgolden20}{oucgolden!20!white}
\colorlet{oucgolden30}{oucgolden!30!white}
\colorlet{oucgolden40}{oucgolden!40!white}
\colorlet{oucgolden50}{oucgolden!50!white}
\colorlet{oucgolden60}{oucgolden!60!white}
\colorlet{oucgolden70}{oucgolden!70!white}
\colorlet{oucgolden80}{oucgolden!80!white}
\colorlet{oucgolden90}{oucgolden!90!white}
% OUC Silver 专银
\definecolor{oucsilver}{RGB}{207, 208, 208}
\colorlet{oucsilver10}{oucsilver!10!white}
\colorlet{oucsilver20}{oucsilver!20!white}
\colorlet{oucsilver30}{oucsilver!30!white}
\colorlet{oucsilver40}{oucsilver!40!white}
\colorlet{oucsilver50}{oucsilver!50!white}
\colorlet{oucsilver60}{oucsilver!60!white}
\colorlet{oucsilver70}{oucsilver!70!white}
\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}
\mode<presentation>
% 定义元素基本颜色
\setbeamercolor{structure}{fg=oucblue, bg=}%主颜色。如果没有其他定义,则显示此颜色。
\setbeamercolor{palette primary}{use=structure, fg=oucblue, bg=}
\setbeamercolor{item}{fg=oucblue70}%item的颜色,是70%的海大蓝。
\setbeamercolor{item projected}{fg=oucblue70}
\setbeamercolor{enumerate item}{fg=black, bg=}
\setbeamercolor{enumerate subitem}{fg=black, bg=}
\setbeamercolor{enumerate subsubitem}{fg=black, bg=}
%默认的标题、副标题、作者、单位、日期,都是白色
\setbeamercolor{title}{fg=white,bg=}
\setbeamercolor{subtitle}{fg=white,bg=}
\setbeamercolor{author}{fg=white,bg=}
\setbeamercolor{date}{fg=white,bg=}
%默认的block,颜色是海大蓝
\setbeamercolor{block title}{bg=oucblue,fg=white}
\setbeamercolor{block body}{bg=oucblue10}
%example block的颜色,是海大灰
\setbeamercolor{block title example}{bg=oucsilver,fg=white}
\setbeamercolor{block body example}{bg=oucsilver10}
%提示block,用的是海大红
\setbeamercolor{block title alerted}{bg=oucred,fg=white}
\setbeamercolor{block body alerted}{bg=oucred10}
+248
View File
@@ -0,0 +1,248 @@
%!TEX program = xelatex
%% 版本:1.0
%% 作者:杨永全
%% 本文件的主要作用,是定义各种元素的字体
%% 完成日期:2022-05-09
\usepackage[UTF8]{ctex}
%\usepackage{xeCJK}
%字体
%设置英文字体 鸿蒙字体
\setmainfont[
Path=fonts/,
BoldFont=HarmonyOS_Sans_Bold.ttf,
ItalicFont=HarmonyOS_Sans_Regular_Italic.ttf,
BoldItalicFont=HarmonyOS_Sans_Bold_Italic.ttf,
]{HarmonyOS_Sans_Regular.ttf}
\setsansfont[
Path=fonts/,
BoldFont=HarmonyOS_Sans_Bold.ttf,
ItalicFont=HarmonyOS_Sans_Regular_Italic.ttf,
BoldItalicFont=HarmonyOS_Sans_Bold_Italic.ttf,
]{HarmonyOS_Sans_Regular.ttf}
\setmonofont[
Path=fonts/
]{HarmonyOS_Sans_Regular.ttf}
%设置中文字体 鸿蒙字体
\setCJKmainfont[
Path=fonts/,
BoldFont=HarmonyOS_Sans_SC_Bold.ttf,
ItalicFont=HarmonyOS_Sans_SC_Regular.ttf,
BoldItalicFont=HarmonyOS_Sans_SC_Bold.ttf
]{HarmonyOS_Sans_SC_Regular.ttf}
\setCJKsansfont[
Path=fonts/,
BoldFont=HarmonyOS_Sans_SC_Bold.ttf,
ItalicFont=HarmonyOS_Sans_SC_Regular.ttf,
BoldItalicFont=HarmonyOS_Sans_SC_Bold.ttf
]{HarmonyOS_Sans_SC_Regular.ttf}
\setCJKmonofont[
Path=fonts/
]{HarmonyOS_Sans_SC_Regular.ttf}
%以下为原模板代码,未做改动
\mode<presentation>
\setbeamerfont{sectiontitle}{size*={18pt}{20pt},series=\bfseries} % section标题字体大小
\setbeamerfont{title}{size*={15pt}{16pt},series=\bfseries} % 标题字体大小
\setbeamerfont{subtitle short}{size*={11pt}{12pt},series=\mdseries} % 副标题 短的 字体大小
\setbeamerfont{subtitle long}{size*={9pt}{9pt},series=\mdseries} % 副标题 长的 字体大小
\setbeamerfont*{subtitle}{parent=subtitle long} % 使用父标题
\setbeamerfont*{subtitle}{parent=subtitle short} % 使用父标题
%\setbeamerfont{normal text}{size*={8pt}{9pt}} % 14pt, baselineskip 18pt
\setbeamerfont{footline}{size*={6pt}{7pt}} %页脚文字大小
%\setbeamerfont{frametitle}{size*={16pt}{16pt},series=\bfseries} %30pt, baselineskip 36pt
\setbeamerfont{framesubtitle}{size*={10pt}{11pt},series=\mdseries} % 普通页面,副标题的字体大小
% 特殊文本域的字体设置
\setbeamerfont{caption}{size=\small}
\setbeamerfont{caption name}{parent={structure,caption}}
\setbeamerfont{date}{size*={10pt}{10pt}}
\setbeamerfont{footline}{parent={tiny structure}}
\setbeamerfont{headline}{parent={tiny structure}}
\setbeamerfont{institute}{size=\footnotesize, series=\itshape}
\setbeamerfont{navigation symbols}{size*={7pt}{8pt}}
\setbeamerfont{section in toc}{parent=structure}
\setbeamerfont{section in toc shaded}{parent=section in toc}
% 列表
\setbeamerfont{item}{parent=structure}
\setbeamerfont{subitem}{parent=item}
\setbeamerfont{subsubitem}{parent=subitem}
\setbeamerfont{item projected}{size=\tiny, parent={item, projected text}}
\setbeamerfont{subitem projected}{parent=item projected}
\setbeamerfont{subsubitem projected}{parent=subitem projected}
\setbeamerfont{description item}{parent=item}
\setbeamerfont{enumerate item}{parent=item}
\setbeamerfont{enumerate subitem}{parent=subitem}
\setbeamerfont{enumerate subsubitem}{parent=subsubitem}
\setbeamerfont{itemize/enumerate body}{}
\setbeamerfont{itemize/enumerate subbody}{size=\small}
\setbeamerfont{itemize/enumerate subsubbody}{size=\footnotesize}
\setbeamerfont{itemize item}{parent=item}
\setbeamerfont{itemize subitem}{parent=subitem}
\setbeamerfont{itemize subsubitem}{parent=subsubitem}
\makeatletter
%% 字母间距
\providecommand{\emptydummyb}[1]{} % eats argument of \uppercase() and and \addfontfeature{}
\providecommand{\emptydummya}[2][]{#2}{} % eats optional argument of textls and forwards #2 argument
\providecommand{\addfontfeature}[1]{} % defined only if latex or pdflatex is used
\providecommand{\textls}[2][]{#2}{} % defined only if microtype is loaded
%% \MakeTextUppercase 原本由 textcase 宏包提供,但本模板并未加载该宏包,
%% 导致 title/subtitle/part/frametitle 的 allcaps 选项报 Undefined control sequence。
%% 这里在未定义时退回到 LaTeX 内核的 \MakeUppercase(新版内核语义与 textcase 一致)。
\@ifundefined{MakeTextUppercase}{\let\MakeTextUppercase\MakeUppercase}{}
% 定义的一些其他命令
\def\beameroucslide@titleformat#1{#1}
\def\beameroucslide@subtitleformat#1{#1}
\def\beameroucslide@partformat#1{#1}
\def\beameroucslide@frametitleformat#1{#1}
%% 标题文字定义
\pgfkeys{
/beameroucslide/font/title/.cd,
.is choice,
.default=regular,
regular/.code={%
\let\beameroucslide@titleformatcaps\emptydummya%
\let\beameroucslide@titleformatspacinga\emptydummya%
\let\beameroucslide@titleformatspacingb\emptydummyb%
},
allcaps/.code={%
\let\beameroucslide@titleformatcaps\MakeTextUppercase%
\let\beameroucslide@titleformatspacinga\emptydummya%
\let\beameroucslide@titleformatspacingb\emptydummyb%
},
}
%% 副标题文字定义
\pgfkeys{
/beameroucslide/font/subtitle/.cd,
.is choice,
.default=allcaps,
regular/.code={%
\let\beameroucslide@subtitleformatcaps\emptydummya%
\let\beameroucslide@subtitleformatspacinga\emptydummya%
\let\beameroucslide@subtitleformatspacingb\emptydummyb%
\setbeamerfont{subtitle long}{size*={9pt}{11pt},series=\bfseries} % 18pt, baselineskip 22pt
},
allcaps/.code={%
\let\beameroucslide@subtitleformatcaps\MakeTextUppercase%
\let\beameroucslide@subtitleformatspacinga\emptydummya%
\let\beameroucslide@subtitleformatspacingb\emptydummyb%
\setbeamerfont{title}{size*={16pt}{16pt},series=\bfseries} % 30pt, baselineskip 36pt%
},
}
%% 普通页面文字设置
\pgfkeys{
/beameroucslide/font/frametitle/.cd,
.is choice,
.default=allcaps,
regular/.code={%
\let\beameroucslide@frametitleformatcaps\emptydummya%
\let\beameroucslide@frametitleformatspacinga\emptydummya%
\let\beameroucslide@frametitleformatspacingb\emptydummyb%
\setbeamerfont{frametitle}{size*={14pt}{18pt},series=\bfseries} % 32pt, baselineskip 36pt%
},
allcaps/.code={%
\let\beameroucslide@frametitleformatcaps\MakeTextUppercase%
\let\beameroucslide@frametitleformatspacinga\emptydummya%
\let\beameroucslide@frametitleformatspacingb\emptydummyb%
\setbeamerfont{frametitle}{size*={14pt}{18pt},series=\bfseries} % 32pt, baselineskip 36pt%
},
}
%% 段落文字设置
\pgfkeys{
/beameroucslide/font/part/.cd,
.is choice,
.default=allcaps,
regular/.code={%
\let\beameroucslide@partformatcaps\emptydummya%
\let\beameroucslide@partformatspacinga\emptydummya%
\let\beameroucslide@partformatspacingb\emptydummyb%
\setbeamerfont{part}{size*={16pt}{18pt},series=\bfseries} % 30pt, baselineskip 36pt%
},
allcaps/.code={%
\let\beameroucslide@partformatcaps\MakeTextUppercase%
\let\beameroucslide@partformatspacinga\emptydummya%
\let\beameroucslide@partformatspacingb\emptydummyb%
\setbeamerfont{part}{size*={16pt}{18pt},series=\bfseries} % 30pt, baselineskip 36pt%
},
}
% redefine beamer title, subtitle, part and frametitle command
\patchcmd{\beamer@title}%
{\def\inserttitle{#2}}%
{\protected\def\inserttitle{{\beameroucslide@titleformatspacingb{LetterSpace=15.0}\beameroucslide@titleformatcaps{\beameroucslide@titleformatspacinga[120]{#2}}}}}%
{}%
{\PackageError{beameroucslide}{Patching original title failed}\@ehc}
\patchcmd{\beamer@subtitle}%
{\def\insertsubtitle{#2}}%
{\protected\def\insertsubtitle{{\beameroucslide@subtitleformatspacingb{LetterSpace=15.0}\beameroucslide@subtitleformatcaps{\beameroucslide@subtitleformatspacinga[120]{#2}}}}}%
{}%
{\PackageError{beameroucslide}{Patching original subtitle failed}\@ehc}
\patchcmd{\beamer@part}%
{\def\insertpart{\expandafter\hyperlink\partlink}}%
{\def\insertpart{{\beameroucslide@partformatspacingb{LetterSpace=15.0}\beameroucslide@partformatcaps{\beameroucslide@partformatspacinga[120]{\expandafter\hyperlink\partlink}}}}}%
{}%
{\PackageError{beameroucslide}{Patching original part failed}\@ehc}
% beamer 3.69(TeX Live 2023)起 \beamer@@frametitle 的定义发生了变化:
% 用 \beamer@insertframetitlecontinuation 取代了 \usebeamertemplate*{frametitle continuation}。
% 因此这里按 beamer 版本分别处理,保证在 TeX Live 2022 与 2023 下都能编译通过。
% 注意:判断必须写在文件顶层(不能把 \patchcmd 嵌进 \@ifundefined 等宏的参数里),
% 否则 \patchcmd 的搜索串会被改写而导致补丁失败。
\ifcsname beamer@insertframetitlecontinuation\endcsname
% 新版 beamer(TeX Live 2023 及以后):按新定义重写,并加入标题格式控制
\long\def\beamer@@frametitle[#1]#2{%
\ifblank{#2}{}{%
\gdef\insertframetitle{{\beameroucslide@frametitleformatcaps{#2}%
\ifnum\beamer@autobreakcount>0\relax{}\space%
\beamer@insertframetitlecontinuation\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}%
}%
\else
% 旧版 beamer(TeX Live 2022 及以前):沿用原有的补丁方式
\patchcmd{\beamer@@frametitle}
{{%
\gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}\space%
\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}}
{{%
\gdef\insertframetitle{{\beameroucslide@frametitleformatcaps{#2}\ifnum%
\beamer@autobreakcount>0\relax{}\space%
\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}}
{}
{\PackageError{beameroucslide}{Patching original frame title failed}\@ehc}%
\fi
\makeatother
@@ -0,0 +1,614 @@
%% 版本:1.0
%% 作者:杨永全
%% 本文件的主要目的,是为了定义列表等内部元素的样式
%% 完成时间:2022-05-09
\RequirePackage{listings,verbatim}%引入代码包
\RequirePackage{caption}
\usepackage{tcolorbox} %引入彩色框
\tcbuselibrary{most} %引入所有包
%列表样式,使用了fontawesome图标
\setbeamertemplate{itemize item}{\faBookmark}
\setbeamertemplate{itemize subitem}{\faHandORight}
\setbeamertemplate{itemize subsubitem}{\faSquare}
%超链接的颜色等信息
\hypersetup{
%colorlinks=true, %超链接颜色,全部使用海大红。
linkcolor=oucred,
urlcolor=oucred,
citecolor=oucred,
anchorcolor=oucred,
}
%代码块的一些设定,原模板代码
\renewcommand{\ttdefault}{pcr}
\lstset{
frame=shadowbox,
numbers=left,
numberstyle=\small,
basicstyle=\ttfamily\upshape\small,
breaklines=true,
backgroundcolor=\color{oucsilver10},
xleftmargin=0.8cm,
framexleftmargin=0em,
keywordstyle=\bfseries\color{oucblue},
stringstyle=\color{oucblue},
commentstyle=\color{mygreen},
rulesepcolor= \color{oucsilver40},
rulecolor=\color{oucblue},
deletekeywords={compile},
escapechar=\&,
escapeinside={<@}{@>}
}
%% 代码块标题设定
\DeclareCaptionFormat{codecaptionformat}{%
\parbox{\textwidth}{\hspace{2em}\textcolor{violet}\faCode~\textcolor{violet}{#1#2}\hspace{.5em}#3}%代码块caption的设置
}
\captionsetup[lstlisting]{format=codecaptionformat}
%设置信息框titlebox
\newtcolorbox{titlebox}[2][]
{
title=#1, %标题
colback = white, %标题背景是白色
colframe = #2, %边框颜色
coltitle = #2, %标题颜色
boxrule=.5pt,%边框的粗细,细一点感觉更精致
boxed title style={size=normal,colframe=white,boxrule=0pt},%标题栏没有背景色和边框,只有文字
left=5pt, right=5pt, top=5pt, bottom=0pt,%内部文字边距
boxsep=5pt,
colbacktitle = white, enhanced,%标题的背景,白色
attach boxed title to top center={yshift=-4mm},%把标题放在中间
opacityupper={100}, %上面边框透明度
}
%设置笔记提示框
\newtcolorbox{notebox}[1][]
{
enhanced,
arc=2pt,%圆角
boxrule=.5pt,%边框
left=5pt, right=5pt, top=0pt, bottom=0pt,%文字边距
boxsep=5pt,
colframe=oucblue,
colback=oucblue10,
colbacktitle=oucblue10,
coltext=oucblue,
title={\textcolor{oucblue}{\faStickyNoteO\hspace{.5em}\bfseries{\textbf{#1}}}},
halign=left,
}
%设置重要提示框
\newtcolorbox{importantbox}[1][]
{
enhanced,
arc=2pt,
boxrule=.5pt,
left=5pt, right=5pt, top=0pt, bottom=0pt,
boxsep=5pt,
colframe=oucred,
colback=oucred10,
colbacktitle=oucred10,
coltext=oucred,
title={\textcolor{oucred}{\faExclamationCircle\hspace{.5em}\bfseries{\textbf{#1}}}},
halign=left,
}
%列表框
\newtcolorbox{vcolorbox}[2][]
{
boxrule=0.5pt,%边框,很细
arc=0pt,outer arc=0pt,%不要圆角
left=5pt, right=5pt, top=0pt, bottom=0pt,
leftrule=5pt, %左侧边框的宽度
colframe=#2,%边框的颜色
colback=white,
colbacktitle=white,
coltext=black,%内部文字的颜色,如果要和标题保持一致,可改为#2
title={\textcolor{#2}{\bfseries{\textbf{#1}}}},%标题样式
halign=left,
}
%要点框
\newtcolorbox{pointbox}[3][]
{
colback = white, %背景是白色
boxrule=0.5pt,%边框的粗细,细一点感觉更精致
colframe = #2, %边框颜色
fonttitle = \bfseries,%标题加粗
colbacktitle = #2, enhanced,
left=2pt, right=2pt, top=5pt, bottom=0pt,%内部文字边距
attach boxed title to top center={yshift=-2mm},
width=\textwidth,
height=#3,
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,
colframe=#1,
boxrule=0.5pt,
arc=2pt,
}
%标题框headbox
\newtcolorbox{headbox}[1]{
colback=#1,
colframe=#1,
boxrule=0.5pt,
arc=2pt,
coltext=white,
fontupper= \bfseries,
left=0pt, right=0pt, top=0pt, bottom=0pt,%内部文字边距
}
%一些元素的中文名称
\renewcommand{\figurename}{图}
\renewcommand{\tablename}{表}
\renewcommand{\lstlistingname}{代码}
\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}%
}}
@@ -0,0 +1,476 @@
%% 版本:1.0
%% 作者:杨永全
%% 本文件的主要作用是定义主题的框架结构等模板信息
%% 完成时间:2022-05-09
\usepackage{dashrule}
% 页面整体布局,原模板代码
\setbeamersize{%
text margin left=0.8cm,
text margin right=0.8cm
}
%% 首页标题背景,原模板代码
\defbeamertemplate{background canvas}{title}{%
\includegraphics[width=\paperwidth, height=\paperheight]{logos/background.jpg}
}
%% 首页页面顶部元素,原模板代码
\newcommand{\topslider}[1]{%
\begin{tikzpicture}[overlay, remember picture]
\draw [fill=#1, draw=none, rounded corners=2pt] (current page.north east)
[turtle={
lt, forward=1.1\paperwidth,
lt, forward=.19\paperheight,
lt, forward=.47\paperwidth,
left=45, forward=1.5ex,
right=45, forward=.63\paperwidth,
home
}];
\end{tikzpicture}
}
%首页顶栏logo,原模板代码
\newcommand{\banner}{%
\begin{tikzpicture}[overlay, remember picture]
\node[anchor=north west, xshift=0.8cm, yshift=-0.6cm] at (current page.north west) {
\includegraphics[scale=0.02]{logos/ouc_logo.png}
};
\end{tikzpicture}
}
%% 底部有弧度的页脚部分,原模板代码
\newcommand{\bottomslider}[1]{%
\begin{tikzpicture}[overlay, remember picture]
\draw [fill=#1, draw=none, rounded corners=2pt] (current page.south east)
[turtle={
lt, fd=1.1\paperwidth,
rt, fd=0.03\paperheight,
rt, fd=.8375\paperwidth,
lt=45, fd=1.5ex,
rt=45, fd=.25\paperwidth,
home
}];
\end{tikzpicture}
}
%首页右下角网址,原模板代码
\newcommand{\oucurl}{%
\begin{tikzpicture}[overlay, remember picture]
\node[anchor=south east, text=oucblue] at (current page.south east) {\tiny www.ouc.edu.cn};
\end{tikzpicture}
}
%% 首页背景元素,原模板代码
\defbeamertemplate{background}{title}{%
\topslider{white}
\banner %首页的Logo
\bottomslider{white} %首页底部颜色
\oucurl %首页底部网址
}
%首页正文部分,原模板代码
\defbeamertemplate{title page}{text}{%
\begin{center} %所有文字居中
\vspace{2.5cm} %标题距离banner的距离
\usebeamercolor[white]{title}\usebeamerfont*{title}\strut{}\inserttitle\par%字体颜色为白色
\vspace{0.5cm}%副标题到主标题的距离
\usebeamercolor[white]{subtitle}\usebeamerfont{subtitle}\strut{}\insertsubtitle\par%字体为白色
\vspace{1.6cm}%作者到副标题的距离
\usebeamercolor[white]{title}\usebeamerfont*{author}\insertauthor\par%字体为白色
\vspace{0.3cm}%作者单位到作者的距离
\usebeamercolor[white]{title}\usebeamerfont*{institute}\insertinstitute%\enspace/字体为白色%\enspace
%\insertdate%如有必要,可再插入日期
\end{center}
}
%设置首页页面模板,原模板代码
\setbeamertemplate{title page}[text]
\pgfkeys{/beameroucslide/outer/.cd,
footline/.initial=empty,
navigation symbols/.initial=empty,
title page/.initial=text
}
%% 普通页面背景,原模板代码
\defbeamertemplate{background canvas}{empty}{}
\pgfkeys{/beamerhgf/outer/.cd,
background canvas/.initial=empty
}
%普通页面左下角信息,原模板代码
\setbeamertemplate{footline}{%
\hspace{0.8cm}
\usebeamercolor[fg]{title}\insertauthor\enspace\vrule width0.3pt\enspace\inserttitle%左下角作者信息和标题信息
\vspace{0.04cm} %页脚到底部的距离
}
% 普通页面右下角Logo,原模板代码
\newcommand{\footerlogo}{%
\begin{tikzpicture}[overlay, remember picture]
\node[anchor=south east, xshift=-1.8cm, yshift=-0.1cm] at (current page.south east) {
\includegraphics[scale=0.008]{logos/ouc_logo_bottom.png}
};
\end{tikzpicture}
}
%右下角页码导航,原模板代码
\setbeamertemplate{navigation symbols}{%
\vspace{-6pt}
\usebeamercolor[fg]{title}\usebeamerfont*{navigation symbols}\insertframenumber/\inserttotalframenumber
}
%% 普通页面frame背景模板,原模板代码
\defbeamertemplate{background}{frame}{%框架
\bottomslider{oucblue} %底部颜色为海大蓝
\footerlogo %右下角logo
}
\defbeamertemplate{headline}{empty}{
}%默认标题为空
%普通页面标题设置
\defbeamertemplate{frametitle}{frame}{%
\vspace{10pt}%
\usebeamercolor[oucblue]{frametitle}\usebeamerfont{frametitle}
\thesubsection. \insertsubsection%显示二级标题
\ifx\insertsubsubsection\empty%如果没有三级标题什么都不做
\else
\usebeamercolor[ouclightblue]{framesubtitle}\usebeamerfont{framesubtitle}
\thesubsubsection.\insertsubsubsection
\fi
\vspace{0.5pt}%标题到下面的线之间的距离
{\color{oucblue}\hrule height 1.5pt depth 0pt}%标题下面的线
}
%因为在frame中引入了section,所以要为目录页面单独设置一个frametitle的模板,去掉了section信息
\defbeamertemplate{frametitle}{outlineframe}{
\vspace{12pt}%
\usebeamercolor[oucblue]{frametitle}\usebeamerfont{frametitle}
\insertframetitle
\usebeamercolor[ouclightblue]{framesubtitle}\usebeamerfont{framesubtitle}
\insertframesubtitle
\vspace{0.5pt}%标题到下面的线之间的距离
{\color{oucblue}\hrule height 1.5pt depth 0pt}%标题下面的线
}
%为普通frame设置模板
\setbeamertemplate{background}[frame]
\setbeamertemplate{frametitle}[frame]
% 定义首页生成命令
\def\maketitle{%
{%
\setbeamertemplate{footline}{}
\setbeamertemplate{navigation symbols}{}
\ifbeamer@inframe%
\titlepage%首页页面
\else%
\setbeamertemplate{frame number}[invisible]%
\setbeamertemplate{date}[invisible]%
\setbeamertemplate{background canvas}[title]%
\setbeamertemplate{background}[title]%
\setbeamertemplate{title page}[title]%
\frame[t, noframenumbering]{\titlepage}%
\fi%
}%
% 将普通的页面模板改回去
\setbeamertemplate{background canvas}[empty]
\setbeamertemplate{background}[frame]
\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{目录}
\ouc@toc@body
\end{frame}
}
%再把模板改回去
\setbeamertemplate{frametitle}[frame]
}
\makeatother
%定义最后一页生成命令
\def\makelast{
\setbeamertemplate{background}[title]
\setbeamertemplate{background canvas}[title]%
\setbeamertemplate{frame number}[invisible]%
\setbeamertemplate{footline}{}
\setbeamertemplate{navigation symbols}{}
\begin{frame}
\begin{center} %所有文字居中
\vspace{3.5cm}
\huge\textcolor{white}{\textbf{\last}}%致谢词
\end{center}
\end{frame}
}
% 分节页面
\AtBeginSection[]{
\begin{frame}%
\begin{center} %所有文字居中
\vspace{2.5cm}%
\huge\textcolor{oucred}{\textbf{\thesection.\insertsectionhead}}%
\end{center}
\end{frame}%
}
%目录样式
\setbeamertemplate{section in toc}[sections numbered]
\setbeamercolor{section in toc}{bg=white,fg=oucred}
%设置有代码块的frame
\newenvironment{fragileframe}%
{\begin{frame}[fragile,environment=fragileframe]}%
{\end{frame}}
+79
View File
@@ -0,0 +1,79 @@
%!TEX program = xelatex
%% 版本:1.0
%% 2022-05-07
%% 作者:杨永全
%%本文件的主要目的,是为了定义幻灯片主题
\RequirePackage{booktabs}
\RequirePackage[T1]{fontenc}
\RequirePackage{fontspec}
\RequirePackage{hyperref}
\RequirePackage[utf8x]{inputenc}
\RequirePackage{listings}
\RequirePackage{tikz}
%原模板代码
\usetikzlibrary{
calc,
turtle,
positioning
}
%应用额外的主题文件,原模板代码
\usefonttheme{OUCSlide}
\usecolortheme{OUCSlide}
\useinnertheme{OUCSlide}
\useoutertheme{OUCSlide}
%原模板代码
\pgfkeys{/beameroucslide/.cd,
.search also={
/beameroucslide/inner,
/beameroucslide/outer,
/beameroucslide/color,
/beameroucslide/font,
},
title=regular,
subtitle=regular,
part=regular,
frametitle=regular,
}
%设置元素编号
\setbeamertemplate{caption}[numbered]
%设置footnote在tcolorbox外面
\makeatletter
% restore footnote internals to those in normal page, not minipage
\def\tcb@restore@footnote{%
\def\@mpfn{footnote}%
\def\thempfn{\arabic{footnote}}%
\let\@footnotetext\tcb@footnote@collect
}
% collect footnote text
\long\def\tcb@footnote@collect#1{%
% expand \@thefnmark before appending before app to \tcb@footnote@acc
\expandafter\gappto\expandafter\tcb@footnote@acc\expandafter{%
\expandafter\footnotetext\expandafter[\@thefnmark]{#1}%
}%
}
\def\tcb@footnote@use{%
\tcb@footnote@acc
\global\let\tcb@footnote@acc\@empty
}
\global\let\tcb@footnote@acc\@empty
\tcbset{
% restore for every box
every box/.style={
before upper pre=\tcb@restore@footnote
},
% use for layer 1 boxes only
every box on layer 1/.append style={
after app=\tcb@footnote@use
}
}
\makeatother
%设置footnote在tcolorbox外面结束
+84
View File
@@ -0,0 +1,84 @@
# 中国海洋大学科技报告 LaTeX 模板
一个基于 `ctexart` 的科技报告模板,可用于撰写科技报告、实验讲义、教程、说明文档等。
> 本目录原为独立仓库 `ouc-report-latex-template`,2026-10 起并入 `ouc_latex_template` 统一维护,旧仓库不再更新。
## 特性
- **中英文字体一体化**:英文默认使用鸿蒙字体(HarmonyOS Sans),中文使用方正书宋 / 小标宋 / 楷体 / 仿宋 / 中等线,字体文件随模板附于 `font/` 目录,编译时自动调用,**无须安装任何字体**;
- **模块化文档类**:`report.cls` 按功能拆分为 `cls/` 下的多个模块(全局设定、字体、页面布局、标题、页眉页脚、信息框、代码块等),便于按需修改;
- **三种信息框**:`titledbox`(带标题)、`notebox`(提示)、`importantbox`(重要),基于 tcolorbox 实现;
- **代码排版**:基于 listings 预设了多种样式,支持行内命令 `shellbox` / `invertedshellbox` 展示 shell 命令及输出;
- **自动水印**:默认以「单位 + 部门」作为全页水印,可在 `input/setting.tex` 中调整文字、透明度与大小;
- **图表与引用**:tabularx 表格、图片插入、自动编号与交叉引用、目录 / 图目录 / 表目录;
- **图标支持**:通过 fontawesome 可直接使用 `\faHeart` 等图标命令(详见根目录 `fontawesome.pdf`)。
## 环境要求
- **TeX 发行版**:TeX Live 2022 及以上(必须使用 **XeLaTeX** 编译);
- 无需额外安装字体或其他依赖,使用 `scheme-full` 或包含常用宏包的发行版即可。
## 使用方法
1. 本目录是 `ouc_latex_template` 仓库的 `科技报告/` 子目录,克隆主仓库即可:
```bash
git clone https://code.yangyq.net/laoyang/ouc_latex_template.git
cd ouc_latex_template/科技报告
```
2. 在 `input/info.tex` 中填写标题、副标题、作者、单位、部门等信息;
3. 在 `report.tex` 中撰写正文(或按 `\input` 方式组织章节文件);
4. 使用 XeLaTeX 编译**两遍**(第一遍生成目录与交叉引用信息,第二遍写入正文):
```bash
xelatex report.tex
xelatex report.tex
```
5. 临时切换字体可使用命令:`\fzss`(方正书宋)、`\fzxbs`(方正小标宋)、`\fzkai`(方正楷体)、`\fzfs`(方正仿宋)、`\fzzdx`(方正中等线)、`\hm`(鸿蒙字体)。
## 署名与联系方式(二次分发前请修改)
模板里有两处「作者 / 联系方式」信息,**性质不同,别改错地方**:
| 想改什么 | 改哪个文件的哪里 | 说明 |
|---|---|---|
| **模板维护者**的联系方式 | `report.cls` 顶部的 `Maintainer:` 一行 | 目前是占位符 `someone@example.com`。它只出现在注释里,**不参与排版**,改成什么都不会影响编译结果 —— 你要把这份模板再分发出去,就换成你自己的。 |
| **报告本身**的作者 / 单位 / 部门 | `input/info.tex` 里的 `\theauthor`、`\theaffiliation`、`\thedept` | 会印在**封面**上;单位与部门还会成为全页**水印**(水印的文字、透明度、大小在 `input/setting.tex` 里调)。 |
> 也就是说:`report.cls` 顶部那行与你的报告内容无关;报告里显示的作者信息一律在 `input/info.tex`。
## TeX Live 版本兼容性
同一份源码在下列 TeX Live 版本下均可直接编译(XeLaTeX),**不需要切分支、不需要改代码**:
| TeX Live | 状态 |
|------|------|
| 2022 | 已验证通过(基线) |
| 2023 | 已验证通过 |
| 2024 | 已验证通过 |
| 2025 | 已验证通过 |
| 2026 | 已验证通过 |
> 本目录原为独立仓库 `ouc-report-latex-template`,曾按 TeX Live 年份维护多套分支。
> 2026-10 并入 `ouc_latex_template` 后**只保留 `main` 一份源码**(已实测各年份通用),
> 旧仓库的分支不再更新。
## 目录结构
```
.
├── report.cls # 文档类(模块化加载 cls/ 下各子模块)
├── cls/ # 功能模块:全局设定、字体、页面、标题、信息框、代码块等
├── input/ # 文档内容:封面、目录、摘要、信息与整体设置
├── figs/ # 图片资源
├── font/ # 鸿蒙及方正字体文件(自动加载)
├── fontawesome.pdf # fontawesome 图标使用手册
└── report.tex # 主文件(XeLaTeX 编译入口)
```
## 关于 `report.pdf`
仓库内的 `report.pdf` 是成品样张,用于预览效果。封面的日期取自 `\today`,
所以**每次编译都会变**;用不同年份的 TeX Live 编译,PDF 体积也可能略有差异,
但**页面渲染内容一致**。以 `report.tex` 源码为准。
+104
View File
@@ -0,0 +1,104 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% boxes
%% 信息框
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 带标题的文本框
\newtcolorbox{titledbox}[1]{%
tikznode boxed title,
enhanced,
arc=3pt,
interior style={white},
attach boxed title to top center = {yshift=-\tcboxedtitleheight/2},
fonttitle=\hm,
colbacktitle=white,coltitle=black,
boxed title style={size=normal,colframe=white,boxrule=0pt},
boxrule=.5pt,
left=5pt, right=5pt, top=5pt, bottom=0pt,
boxsep=5pt,
title={#1},
halign=left,
fontupper=\fzkai
}
%% Note
\newtcolorbox{notebox}{%
enhanced,
arc=2pt,
boxrule=.5pt,
left=5pt, right=5pt, top=0pt, bottom=0pt,
boxsep=5pt,
colframe=NavyBlue,
colback=NavyBlue!5!White,
colbacktitle=NavyBlue!5!White,
coltext=NavyBlue,
title={\textcolor{NavyBlue}{\faStickyNoteO\hspace{.5em}\bfseries{\hm{笔记}}}},
halign=left,
fontupper=\fzkai
}
%% Important
\newtcolorbox{importantbox}{%
enhanced,
arc=2pt,
boxrule=.5pt,
left=5pt, right=5pt, top=0pt, bottom=0pt,
boxsep=5pt,
colframe=Orange,
colback=Orange!5!White,
colbacktitle=Orange!5!White,
coltext=Orange,
title={\textcolor{Orange}{\faExclamationCircle\hspace{.5em}\bfseries{\hm{重要}}}},
halign=left,
fontupper=\fzkai
}
%% verbatim 环境无法直接在新环境中使用
%% 换用 \VerbatimEnvironment \begin{Verbatim}
\RequirePackage{fancyvrb}
%% 命令行
\newenvironment{shellbox}
{%
\VerbatimEnvironment
\begin{tcolorbox}[
enhanced,
arc=2pt,
boxrule=.5pt,
left=5pt, right=5pt, top=0pt, bottom=0pt,
boxsep=5pt,
colframe=black,
colback=white,
coltext=black,
title={},
fontupper=\linespread{1.2}
]%
\begin{Verbatim}
}
{%
\end{Verbatim}
\end{tcolorbox}
}
%% 命令行
\newenvironment{invertedshellbox}
{%
\VerbatimEnvironment
\begin{tcolorbox}[
enhanced,
arc=2pt,
boxrule=.5pt,
left=5pt, right=5pt, top=0pt, bottom=0pt,
boxsep=5pt,
colframe=black!70!white,
colback=black!70!white,
coltext=white,
title={},
fontupper=\linespread{1.2}
]%
\begin{Verbatim}
}
{%
\end{Verbatim}
\end{tcolorbox}
}
+8
View File
@@ -0,0 +1,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Chinese names
%% 中文名称
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\figurename}{图}
\renewcommand{\tablename}{表}
\renewcommand{\lstlistingname}{代码}
\renewcommand{\abstractname}{摘要}
+129
View File
@@ -0,0 +1,129 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% code listings
%% 代码块设定
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{listings,verbatim}
\definecolor{codecolorkeywords}{rgb}{0,0,1}
\definecolor{codecolorcomments}{rgb}{0,0.5,0}
\definecolor{codecolorxmlcomments}{rgb}{0.5,0.5,0.5}
\definecolor{codecolorstrings}{rgb}{0.64,0.08,0.08}
\definecolor{codecolortypes}{rgb}{0.17,0.57,0.68}
\lstdefinelanguage{JavaScript}{
keywords={do, if, in, for, let, new, try, var, case, else, enum, eval, null, this, true, void, with, await, break, catch, class, const, false, super, throw, while, yield, delete, export, import, public, return, static, switch, typeof, default, extends, finally, package, private, continue, debugger, function, arguments, interface, protected, implements, instanceof},
sensitive=true,
comment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[b]',
morestring=[b]"
}
\lstdefinelanguage{TypeScript}{
keywords={abstract, break, case, catch, class, const, continue, debugger, default, delete, do, else, enum, export, extends, false, finally, for, function, if, import, in, instanceof, new, null, return, super, switch, this, throw, true, try, typeof, var, void, while, with, as, implements, interface, let, package, private, protected, public, static, yield, any, boolean, constructor, declare, get, module, require, number, set, string, symbol, type, from, of},
sensitive=true,
comment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[b]',
morestring=[b]"
}
\lstdefinelanguage{golang}{
keywords={break, default, func, interface, select, case, defer, go, map, struct, chan, else, goto, package, switch, const, fallthrough, if, range, type, continue, for, import, return, var},
sensitive=true,
comment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[b]',
morestring=[b]"
}
\lstdefinestyle{mystyle}{
% Basic design
basicstyle=\linespread{1.2}\ttfamily,
frame=tb,
framesep=5pt,
framerule=.5pt,
framexleftmargin=10pt,
rulecolor=\color{black},
abovecaptionskip=0pt,
belowcaptionskip=5pt,
aboveskip=5pt,
backgroundcolor=\color{black!5!white},
% Code design
keywordstyle=\color{codecolorkeywords},
commentstyle=\color{codecolorcomments},
stringstyle=\color{codecolorstrings},
numberstyle=\small\color{gray},
breakatwhitespace=false,
breaklines=true,
captionpos=t,
keepspaces=true,
% Line numbers
numbers=none,
numbersep=15pt,
xleftmargin=10pt,
stepnumber=1,
firstnumber=1,
numberfirstline=true,
% Code
tabsize=4,
showspaces=false,
showstringspaces=false,
showtabs=false,
breaklines=true,
}
\lstset{style=mystyle}
%% 命令行
\lstdefinestyle{bashstyle}{
backgroundcolor=\color{NavyBlue!10!white},
basicstyle=\linespread{1.2}\ttfamily,
keepspaces=true,
numbers=none,
numbersep=10pt,
frame=l,
framerule=2pt,
framesep=5pt,
framexleftmargin=3pt,
framextopmargin=-5pt,
xleftmargin=10pt,
rulecolor=\color{NavyBlue},
% Code
tabsize=4,
showspaces=false,
showstringspaces=false,
showtabs=false,
breaklines=true,
}
%% 命令行输出
\lstdefinestyle{bashoutputstyle}{
backgroundcolor=\color{black!10!white},
basicstyle=\linespread{1.2}\ttfamily,
keepspaces=true,
numbers=none,
numbersep=10pt,
frame=l,
framerule=2pt,
framesep=5pt,
framexleftmargin=3pt,
framextopmargin=-5pt,
xleftmargin=10pt,
rulecolor=\color{black!70!white},
% Code
tabsize=4,
showspaces=false,
showstringspaces=false,
showtabs=false,
breaklines=true,
}
%% 代码列表标题
\RequirePackage{caption}
\DeclareCaptionFormat{codecaptionformat}{%
%%\colorbox{black!20}{
%% \parbox{\textwidth}{#1#2\ttfamily#3}
%%}
\parbox{\textwidth}{\textcolor{violet}\faCode~\textcolor{violet}{#1#2}\hspace{.5em}\fzkai#3}
}
\captionsetup[lstlisting]{format=codecaptionformat}
+4
View File
@@ -0,0 +1,4 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 图片设定
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\graphicspath{{./figs/}{./figure/}{./figures/}{./image/}{./images/}{./graphics/}{./graphic/}{./pictures/}{./picture/}}
+96
View File
@@ -0,0 +1,96 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% fonts settings
%% 字体设定
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% \usepackage{ebgaramond}
%% 开明式:句末点号用占一个汉字宽度,标号和句内点号占半个汉字宽度
%\punctstyle{kaiming}
%\setmainfont{Minion Pro}
% \setmainfont{Myriad Pro}
% \setsansfont{Myriad Pro}
% \setmonofont{Courier Std}
%设置英文字体 鸿蒙字体
% \setmainfont[
% Path=font/,
% BoldFont=Arvo-Bold.ttf,
% ItalicFont=Arvo-Italic.ttf,
% BoldItalicFont=Arvo-BoldItalic.ttf,
% ]{Arvo-Regular.ttf}
\setmainfont[
Path=font/,
BoldFont=HarmonyOS_Sans_Bold.ttf,
ItalicFont=HarmonyOS_Sans_Regular_Italic.ttf,
BoldItalicFont=HarmonyOS_Sans_Bold_Italic.ttf,
]{HarmonyOS_Sans_Regular.ttf}
\setsansfont[
Path=font/,
BoldFont=HarmonyOS_Sans_Bold.ttf,
ItalicFont=HarmonyOS_Sans_Regular_Italic.ttf,
BoldItalicFont=HarmonyOS_Sans_Bold_Italic.ttf,
]{HarmonyOS_Sans_Regular.ttf}
\setmonofont[
Path=font/
]{HarmonyOS_Sans_Regular.ttf}
\setCJKmainfont[
Path=font/,
BoldFont=fangzhengxiaobiaosong_GBK.TTF,
ItalicFont=fangzhengkaiti_GBK.TTF,
BoldItalicFont=fangzhengfangsong_GBK.TTF,
]{fangzhengshusong_GBK.TTF}
\setCJKsansfont[
Path=font/,
BoldFont=HarmonyOS_Sans_SC_Bold.ttf,
ItalicFont=HarmonyOS_Sans_SC_Light.ttf,
BoldItalicFont=HarmonyOS_Sans_SC_Black.ttf,
]{HarmonyOS_Sans_SC_Regular.ttf}
\setCJKmonofont[
Path=font/
]{fangzhengzhongdengxian_GBK.TTF}
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt
%方正书宋
\setCJKfamilyfont{fzss}[
Path=font/
]{fangzhengshusong_GBK.TTF}
\newcommand{\fzss}{\CJKfamily{fzss}}
%方正小标宋
\setCJKfamilyfont{fzxbs}[
Path=font/
]{fangzhengxiaobiaosong_GBK.TTF}
\newcommand{\fzxbs}{\CJKfamily{fzxbs}}
%方正楷体
\setCJKfamilyfont{fzkai}[
Path=font/
]{fangzhengkaiti_GBK.TTF}
\newcommand{\fzkai}{\CJKfamily{fzkai}}
%方正仿宋
\setCJKfamilyfont{fzfs}[
Path=font/
]{fangzhengfangsong_GBK.TTF}
\newcommand{\fzfs}{\CJKfamily{fzfs}}
%方正中等线
\setCJKfamilyfont{fzzdx}[
Path=font/
]{fangzhengzhongdengxian_GBK.TTF}
\newcommand{\fzzdx}{\CJKfamily{fzzdx}}
%鸿蒙字体
\setCJKfamilyfont{hm}[
Path=font/,
BoldFont=HarmonyOS_Sans_SC_Bold.ttf,
ItalicFont=HarmonyOS_Sans_SC_Light.ttf,
BoldItalicFont=HarmonyOS_Sans_SC_Black.ttf,
]{HarmonyOS_Sans_SC_Regular.ttf}
\newcommand{\hm}{\CJKfamily{hm}}
+19
View File
@@ -0,0 +1,19 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 页面设定
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\geometry{
textwidth=138mm,
textheight=215mm,
left=27mm,
%% or
%% inner=23mm,
right=27mm,
%% or
%% outer=18mm,
top=25.4mm, bottom=25.4mm,
headheight=2.17cm,
headsep=4mm,
footskip=12mm,
heightrounded,
}
+19
View File
@@ -0,0 +1,19 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% global settings
%% 全局格式设定
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 添加首行缩进,两个字符
\setlength{\parindent}{2em}
%% 行距
\linespread{1.5}
%% 表格
\captionsetup[table]{belowskip=0pt,aboveskip=5pt}
%粗线,在表格中可以画出更粗的线条
\newcommand{\thickhline}{%
\noalign {\ifnum 0=`}\fi \hrule height 1pt
\futurelet \reserved@a \@xhline
}
+32
View File
@@ -0,0 +1,32 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% head and foot
%% 页眉页脚
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \RequirePackage{fancyhdr}
% \RequirePackage{zhnumber}
% \pagestyle{fancy}
% \fancyhf{}
% \renewcommand\headrulewidth{.5pt}
% \renewcommand\footrulewidth{0pt}
% %\futurelet\TMPheadrule\def\headrule{{\color{violet}\TMPheadrule}}
% \renewcommand{\sectionmark}[1]{\markright{#1}}
% \fancyhead[C]{\fzkai{\rightmark}}
% %\fancyhead[R]{\thepage}
% \fancyfoot[L]{\fzkai{\author}}
% \fancyfoot[R]{\thepage}
\pagestyle{fancy}
\fancyhf{}
\renewcommand\headrulewidth{.5pt}
\renewcommand\footrulewidth{0pt}
%\futurelet\TMPheadrule\def\headrule{{\color{violet}\TMPheadrule}}
%\renewcommand{\sectionmark}[1]{\markright{#1}}
\fancyhead[C]{\fzkai{\themaintitle}}
%\fancyhead[C]{\@title}
%\fancyhead[R]{\thepage}
%\fancyfoot[L]{\fzkai{\@author}}
\fancyfoot[C]{\thepage}% / \pageref{LastPage}}
+12
View File
@@ -0,0 +1,12 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% hyperref settings
%% 超链接设定
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\hypersetup{
bookmarksnumbered,
colorlinks,
linkcolor={black},
citecolor={black},
urlcolor={black}
}
+34
View File
@@ -0,0 +1,34 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 标题、目录等设定
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ctexset{
% 修改 section文字样式,
section={
name={,.},%编号和文字中间用.。
number={\arabic{section}},%编号形式:\arabic设置为阿拉伯数字,\chinese设置为中文,\roman设置为小写罗马字母,\Roman设置为大写罗马字母,\alph设置为小写英文,\Alph设置为大写英文。
format=\hm\bfseries\raggedright\zihao{4},%鸿蒙字体,小四号字,右对齐。
aftername=\hspace{5pt},%编号和标题的距离
% beforeskip=1ex,%标题与前文的距离
% afterskip=1ex,%标题与后文的距离
},
%修改subsection文字样式
subsection={
format=\hm\bfseries\raggedright\zihao{-4},
aftername=\hspace{5pt},%编号和标题的距离
},
%修改subsubsection文字样式
subsubsection={
format=\hm\bfseries\raggedright\zihao{5},
aftername=\hspace{5pt},%编号和标题的距离
}
}
%设置目录的显示样式
\renewcommand{\contentsname}{\begin{center} \normalsize \hm\zihao{4}\textbf{目录} \end{center}}
\renewcommand{\listfigurename}{\begin{center} \normalsize \hm\zihao{4}\textbf{插图目录} \end{center}}
\renewcommand{\listtablename}{{\begin{center} \normalsize \hm\zihao{4}\textbf{表格目录} \end{center}}}
%给目录加上点
\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}} % 给 parts 加点
%\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} % 给 chapters 加点
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}} % 给 sections加点
Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+14
View File
@@ -0,0 +1,14 @@
\newpage
\thispagestyle{empty}
\begin{center}
{\hm\bfseries \zihao{3} \themaintitle}%摘要页面的标题
\end{center}
\renewcommand{\abstractname}{\hm\bfseries{\zihao{4}摘要}}
\begin{abstract}
这是一个很好用的Latex模板,经过不断的修改和迭代进化。这里,就介绍一下这个模板的使用方法,希望对你有所帮助。
\vspace{2ex}
\noindent{\textbf{关键词:}Latex,\hspace{.5em}模板,\hspace{.5em}学习}%关键词不缩进
\end{abstract}
+65
View File
@@ -0,0 +1,65 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 封面页面
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{titlepage}
\centering % 居中显示
\scshape %
\vspace*{\baselineskip} % 顶部空白
%------------------------------------------------
% 标题
%------------------------------------------------
\rule{\textwidth}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt} % 上面粗的线
\rule{\textwidth}{0.4pt} % 细线
\vspace{30pt} % 和标题之间的空白
{\hm\bfseries \zihao{2} \themaintitle} % 标题
\vspace{0.75\baselineskip} % 标题下面的空白
\rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt} % 细线
\rule{\textwidth}{1.6pt} % 粗线
\vspace{2\baselineskip} % 标题后的空白
%------------------------------------------------
% 副标题
%------------------------------------------------
{\hm \zihao{3} \thesubtitle} % 副标题
\vspace*{3\baselineskip} % 空白
%------------------------------------------------
% 作者信息
%------------------------------------------------
作者
\vspace{0.5\baselineskip} % 作者前空白
{\scshape\Large \theauthor } % 作者列表
\vspace{0.5\baselineskip} % 空白
\fzkai{\theaffiliation} \\% 作者单位
%\vspace*{3\baselineskip}
\fzkai{\thedept}
\vfill % 空白
%------------------------------------------------
% 出版社或单位
%------------------------------------------------
%\plogo % Publisher logo
\vspace{0.3\baselineskip} % 空白
%2017 % Publication year
{\large \thedate} % 日期
\end{titlepage}
+10
View File
@@ -0,0 +1,10 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 标题和作者等基本信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\themaintitle}{这是一个很好用的LaTex模板} %标题
\newcommand{\thesubtitle}{这里是副标题} %副标题
\newcommand{\theauthor}{作者名字}%作者名字
\newcommand{\thedate}{\today}%时间
\newcommand{\theaffiliation}{中国海洋大学}%工作单位
\newcommand{\thedept}{计算机科学与技术学院}%部门
+18
View File
@@ -0,0 +1,18 @@
%整体设置
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 页眉页脚
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \RequirePackage{fancyhdr}
% \RequirePackage{zhnumber}
% \RequirePackage{lastpage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 设置页面水印
% \usepackage[firstpage]{draftwatermark} % 只有第一页加水印
\SetWatermarkText{\theaffiliation\thedept} % 设置水印文字内容
% \SetWatermarkText{\includegraphics{fig/ZJDX-WaterMark.eps}} % 设置水印LOGO
\SetWatermarkLightness{0.95} % 设置水印透明度 0-1
\SetWatermarkScale{0.2} % 设置水印大小 0-1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+17
View File
@@ -0,0 +1,17 @@
%目录页面
\newpage
\thispagestyle{empty}
%\clearpage
\tableofcontents
%插图目录页面
\newpage
\thispagestyle{empty}
%\clearpage
\listoffigures
%表格目录页面
\newpage
%\clearpage
\thispagestyle{empty}
\listoftables
+44
View File
@@ -0,0 +1,44 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% A Report LaTeX Template for OUC
%% Maintainer: someone@example.com
%% 2022-03-01
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{report}[A Report LaTeX Template for OUC]
\LoadClass[a4paper]{ctexart}
\RequirePackage{xunicode}
\RequirePackage[dvipsnames]{xcolor}
\RequirePackage[open,openlevel=0,atend]{bookmark}
\RequirePackage{fontspec}
\RequirePackage{titlesec}
\RequirePackage{zhnumber}
\RequirePackage[many]{tcolorbox}
\RequirePackage{fontawesome}
\RequirePackage{graphicx}
\RequirePackage{graphbox}
\RequirePackage{wrapfig}
\RequirePackage{geometry}
\RequirePackage{hyperref}
\RequirePackage{indentfirst}
\RequirePackage[singlelinecheck=false]{caption}
\RequirePackage{titletoc}
\RequirePackage{fancyhdr}
\RequirePackage{zhnumber}
\RequirePackage{lastpage}
\RequirePackage{ctex}
\RequirePackage[subfigure]{tocloft}
\RequirePackage{subfigure}
%引入模块
\input{cls/global.cls}%全局设定
\input{cls/hyperref.cls}%超链接
\input{cls/figs.cls}%图片
\input{cls/geometry.cls}%页面布局
\input{cls/font.cls}%字体
\input{cls/title.cls}%标题
\input{cls/boxes.cls}%信息框
\input{cls/headandfoot.cls}%页眉页脚
\input{cls/code.cls}%代码块
\input{cls/chinesename.cls}%中文名称
Binary file not shown.
+229
View File
@@ -0,0 +1,229 @@
%!TEX program = xelatex
\documentclass{report}
\usepackage{graphicx}
\usepackage[dvipsnames]{xcolor}
\usepackage{wrapfig}
\usepackage{enumerate}
\usepackage{amsmath,mathrsfs,amsfonts}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{colortbl}
\usepackage{multirow,makecell}
\usepackage{multicol}
\usepackage{ulem} % \uline
\usepackage{listings}
\usepackage{tikz}
\usepackage{tcolorbox}
\usepackage{fontawesome}
\usepackage[justification=centering]{caption}
\usepackage{draftwatermark}% 所有页加水印
\usepackage{titletoc}
\usepackage{ctex}
\usepackage[subfigure]{tocloft}
\usepackage{subfigure}
\input{input/info.tex}
\input{input/setting.tex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 正文开始
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\sloppy % 解决中英文混排文字超出边界问题
\input{input/cover.tex}
\input{input/toc.tex}
\input{input/abstract.tex}
\newpage%开始新的一页,正文开始
\setcounter{page}{1}%页码编号,从1开始
\section{准备工作}
在正式开始使用模板之前,需要你安装LiveTex,并安装任何可用的编辑器。
不需要再做其他配置,字体在font文件夹中,编译时会自动调用,无须额外安装。
\section{字体}
在模板中,默认使用的字体是鸿蒙字体,除此之外,还定义了一些其他的中文字体。
英文字体,默认使用的是鸿蒙字体(HarmonyOS Sans),现在你看到的应该就是这个字体的效果。这些设置,可以在cls中,字体设定里面进行修改。
中文字体,使用的是鸿蒙字体、方正小标宋、方正楷体、方正仿宋、方正中等线等。
中文的默认字体衬线字体是方正书宋,加粗字体是方正小标宋,就像这样:\textbf{这里是加粗字体}。斜体的字体是方正楷体,就像这样:\textit{这里是中文斜体}。斜体粗体的字体是方正仿宋,就像这样:\textbf{\textit{这里是粗体斜体}}。中文的无衬线字体sans font使用的是方正黑体,你应该可以在标题中看到它。中文等宽字体,使用的是方正中等线字体。
默认的无衬线字体是鸿蒙字体,你应该可以在各种标题中看到它的样子。
同样,上述的字体,在cls中,都可以进行设置。
另外,可以使用额外的命令,来临时改变某一段文字的字体设置,这些命令包括:fzss(方正书宋)、 fzxbs(方正小标宋)、、fzkai(方正楷体)、fzfs(方正仿宋)、fzzdx(方正中等线)、hm(鸿蒙字体)。使用方法是使用斜线命令的方式,这样:{\fzss 方正书宋}、 {\fzxbs 方正小标宋}、{\fzkai 方正楷体}、{\fzfs 方正仿宋}、{\fzzdx 方正中等线}、{\hm 鸿蒙字体}。
\section{标题}
文档模板支持三级标题,并且自动编号。上面就是一级标题的样子。
\subsection{这里是二级标题}
\subsubsection{这里是三级标题}
\section{列表}
列表分为有序列表和无序列表。
\subsection{无序列表}
无序列表使用itemize。
\begin{itemize}
\item \textbf{第一个有序列表}。可以在这里写列表的内容。
\item \textbf{第二条列表}。这里继续显示列表内容。
\end{itemize}
默认的前缀是实心的 黑色原点, 但是我们可以在 \textbackslash item[] 中进行自定义符号, 一般来说, 想要的符号都能够进行显示。
\begin{itemize}
\item[-] 条目1
\item[+] 条目2
\item[x] 条目3
\item[/] 条目4
\item[*] 条目5
\item[a] 条目6
\item[$\circ$] 条目7
\item[$\bigotimes$] 条目8
\item .....
\end{itemize}
\subsection{有序列表}
有序列表使用enumerate。
\begin{enumerate}
\item 方括号中写的是列表的样式。可以是()、[]等。如果要改变编号样式,可使用begin\{enumerate\}[(1)]等。
\item 如果使用了特殊的样式导致没有了缩进,可以使用begin\{enumerate\}[itemindent=2em]设置缩进。
\end{enumerate}
\section{图表信息}
可以插入表格,如表\ref{table1}所示\footnote{更复杂的表格,可以使用在线工具生成 https://www.tablesgenerator.com/}。
\noindent
\begin{table}[h!]
\caption{一个表格的实例}\label{table1}
\begin{tabularx}{\textwidth}{>{\hsize=.6\hsize\raggedright\arraybackslash}X>{\raggedright\arraybackslash}X}\toprule
\bfseries{食物} & \bfseries{菜谱}\\ \midrule
热狗 & 面包、香肠 \\
包子 & 面粉、馅料 \\ \bottomrule
\end{tabularx}
\end{table}
可以插入图片,如图\ref{fig1}所示。
\begin{figure}[!h]
\centering
\includegraphics[width=12cm]{figs/1.jpg}
\caption{这是一个示例图片}
\label{fig1}
\end{figure}
在其他的地方,通过输入图片的label来引用图片,就像这样:如图\ref{fig1}所示。
\section{代码}
模板中支持插入代码片段。
就像下面这些例子一样:
\begin{lstlisting}[language=TypeScript,caption={src/app/app.module.ts}]
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
@NgModule({
imports: [ BrowserModule ],
providers: [ Logger ],
declarations: [ AppComponent ],
exports: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
\end{lstlisting}
\begin{lstlisting}[language=Java,caption={src/app/app.module.ts}]
import org.sun.com;
public class helloworld{
public static void main()
{
System.out.println("hello world!");
}
}
\end{lstlisting}
\begin{lstlisting}[style=bashstyle]
cd my-app
ng serve --open
\end{lstlisting}
\begin{lstlisting}[style=bashoutputstyle]
blablabla
\end{lstlisting}
还可以展示linux shell命令:
\begin{invertedshellbox}
npm install -g @angular/cli
\end{invertedshellbox}
也可以使用shell box。
\begin{shellbox}
cd my-app
ng serve --open
\end{shellbox}
还可以展示shell执行结果:
\begin{lstlisting}[style=bashoutputstyle]
src
app
app.component.css
app.component.html
app.component.spec.ts
app.component.ts
app.module.ts
assets
.gitkeep
environments
environment.prod.ts
environment.ts
browserslist
favicon.ico
index.html
...
\end{lstlisting}
\section{文本框}
模板支持三中文本框,分别是titledbox、notebox和importantbox。
\begin{titledbox}{HTTP/Console 内核}
HTTP 内核继承自 \verb|Illuminate\Foundation\Http\Kernel| 类,该类定义了一个 \verb|bootstrappers| 数组,这个数组中的类在请求被执行前运行,这些 \verb|bootstrappers| 配置了错误处理、日志、检测应用环境以及其它在请求被处理前需要执行的任务。
\end{titledbox}
\begin{notebox}
HTTP 内核继承自 \verb|Illuminate\Foundation\Http\Kernel| 类,该类定义了一个 \verb|bootstrappers| 数组,这个数组中的类在请求被执行前运行,这些 \verb|bootstrappers| 配置了错误处理、日志、检测应用环境以及其它在请求被处理前需要执行的任务。
\end{notebox}
\begin{importantbox}
HTTP 内核继承自 \verb|Illuminate\Foundation\Http\Kernel| 类,该类定义了一个 \verb|bootstrappers| 数组,这个数组中的类在请求被执行前运行,这些 \verb|bootstrappers| 配置了错误处理、日志、检测应用环境以及其它在请求被处理前需要执行的任务。
\end{importantbox}
\section{图标}
模板还支持使用图标,图标主要来自于fontawesome。其使用说明,可以参考文件夹中的fontawesome.pdf。
\faHeart
\end{document}
+1 -1
View File
@@ -1,4 +1,4 @@
# exam —— 试卷与参考答案 LaTeX 模板
# 试卷 —— 试卷与参考答案 LaTeX 模板
中国海洋大学期末考试**试卷**与**参考答案及评分标准**的 XeLaTeX 模板。
两份模板均不含真题,题目与分值都是示意,按教学大纲替换即可。

Some files were not shown because too many files have changed in this diff Show More