Files
ouc_latex_template/幻灯片/theme/beamerouterthemeOUCSlide.sty
T
laoyang e70339fcf6 全库脱敏:清除真实姓名、个人账号与私有域名 #17
开源前排查,发现三处真实个人信息残留,全部清除:

1. 真名「杨永全」→ 中性署名「中国海洋大学 LaTeX 模板库」
   幻灯片/ 下 6 个 sty 文件头的「%% 作者:杨永全」。

2. 个人账号 dryangyq → 占位地址
   幻灯片/slides.tex 第 66 行脚注里的 github/gitee/gitlab 三个
   dryangyq 仓库地址,改为 example.org 占位并注明开源后替换。

3. 个人域名 yangyq.net + 私有 Gitea 账号 laoyang → 占位地址
   幻灯片/README.md 与科技报告/README.md 的 clone 地址
   code.yangyq.net/laoyang/... 改为 example.org 占位。

另重编幻灯片/slides.pdf:旧 PDF 的脚注里还印着 dryangyq 与
yangyq.net 的 URL(源码改了但成品没重编),逐字提取确认后覆盖。

验证:
- 全库源码(.tex/.sty/.cls/.md)grep 杨永全 / dryangyq / yangyq /
  yongquan / 永全 全部零命中
- 全库 PDF 成品用 pymupdf 提取渲染文本,上述关键词零命中
- 幻灯片重编 30 页、0 error

未处理(遗留,需另决策):git 历史 27 个 commit 的作者签名是
「laoyang <i@yangyq.net>」,含个人域名邮箱。若推到公开平台需
git filter-repo 重写历史(改全部 SHA + force push),属破坏性操作,
本单不做。
2026-10-29 08:17:08 +08:00

476 lines
18 KiB
TeX
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
%% 版本:1.0
%% 作者:中国海洋大学 LaTeX 模板库
%% 本文件的主要作用是定义主题的框架结构等模板信息
%% 完成时间: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}}