所有模板目录改为中文名,并入幻灯片与科技报告两个仓库(#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:
@@ -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}
|
||||
@@ -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}}
|
||||
@@ -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外面结束
|
||||
Reference in New Issue
Block a user