新增「扁平简约图示组件」:9 个纯 TikZ 绘图元素

设计基调:圆角色块 + 实心纯色 + 白字 + 细箭头。
**无渐变、无阴影、无立体**(已量化验证:PDF 中 shading 对象数为 0)。
不依赖 smartdiagram 等外部绘图宏包,全部用 TikZ 自绘。

九个组件(颜色列表写在方括号里,可写一个或多个):
  \flatflow[颜色]{条目1, 条目2, ...}          横向箭头流程,自动等分满宽
  \flatstack[颜色]{...}                       纵向流程
  \flatcycle[颜色]{...}                       循环图(弧线箭头)
  \flathub[颜色]{中心}{环绕1, 环绕2, ...}      中心辐射
  \flatsteps[颜色]{...}                       阶梯递进
  \flattime[颜色]{年份列表}{事件列表}           时间轴(上下交替)
  \flatquad[颜色]{左上}{右上}{左下}{右下}       四象限
  \flatpyramid[颜色]{顶层, ..., 底层}          金字塔
  \flatcompare[左色][右色]{左标题}{左内容}{右标题}{右内容}   左右对比

颜色支持列表循环:\flatflow[oucblue,oucred]{...} 两个块不同色;
\flatflow[oucred,oucblue]{六个块} 则按红蓝红蓝循环取色。

防错:颜色是可选参数,若误写成花括号,会报
「图示组件的颜色要写在方括号里」的明确错误(不会静默出错)。

实现中踩到的三个本机 expl3/pgf 坑(均已写进代码注释):
 - 长度做乘除一律用 \pgfmathsetlength,且表达式里只能是「长度」或「纯数字」,
   绝不能出现计数器(否则静默算成 0pt)。
 - \foreach 每轮迭代会开组,内层 \def 出组即失效,需用 \global\def。
 - \ifstrequal 在本机恒为假,字符串比较必须用 \ifx。

另修正一处定义顺序问题:组件必须放在 \ExplSyntaxOff 之后,
否则 `@` 不是字母类别,\fl@... / fl@i@... 这类名字会被解析错。

已验证:TL2022~2026 全部 0 错误 0 溢出;跨版本渲染逐像素一致;
slides.tex 新增 5 页演示,README 新增「图示组件(扁平风格)」一节。
This commit is contained in:
2026-10-13 15:06:04 +08:00
parent 5532dd2fc7
commit e60e1d768b
5 changed files with 398 additions and 1 deletions
+70
View File
@@ -308,6 +308,76 @@
\end{frame}
\subsection{图示组件}
\begin{frame}
\frametitle{横向流程}
流程类图示用 \texttt{\textbackslash flatflow},条目用逗号分隔,自动等分排布。\\
颜色写在方括号里:写一个则全部同色,写多个则按顺序取色。\\
\vspace{4pt}
\textbf{单色:}
\begin{center}
\flatflow[oucblue]{数据采集, 数据清洗, 模型训练, 结果评估}
\end{center}
\vspace{4pt}
\textbf{每个块不同颜色:}
\begin{center}
\flatflow[oucblue,oucred,oucpine,oucamber]{数据采集, 数据清洗, 模型训练, 结果评估}
\end{center}
\end{frame}
\begin{frame}
\frametitle{纵向流程与循环}
\begin{columns}
\begin{column}{0.42\textwidth}
\centering
\flatstack[oucblue,oucred,oucpine,oucdusk]{提出问题, 建立模型, 求解验证}
\end{column}
\begin{column}{0.42\textwidth}
\centering
\flatcycle[oucblue,oucred,oucpine,oucamber]{计划, 执行, 检查, 改进}
\end{column}
\end{columns}
\end{frame}
\begin{frame}
\frametitle{中心辐射}
\begin{center}
\flathub[oucblue,oucred,oucpine,oucamber,oucdusk]{核心}{可行性, 必要性, 创新性, 实用性}
\end{center}
\end{frame}
\begin{frame}
\frametitle{阶梯递进}
\begin{center}
\flatsteps[oucblue,oucred,oucpine,oucamber]{基础研究, 技术开发, 集成验证, 示范应用}
\end{center}
\end{frame}
\begin{frame}
\frametitle{时间轴与四象限}
\begin{center}
\flattime[oucblue,oucred,oucpine,oucdusk]{2020, 2021, 2023, 2025}{立项, 方案设计, 中期检查, 结题验收}
\end{center}
\vspace{8pt}
\begin{center}
\flatquad[oucblue,oucred,oucpine,oucamber]{重要且紧急}{重要不紧急}{紧急不重要}{不重要不紧急}
\end{center}
\end{frame}
\begin{frame}
\frametitle{金字塔与对比}
\begin{center}
\flatpyramid[oucblue,oucred,oucpine,oucamber]{总体目标, 实施策略, 具体措施, 落地行动}
\end{center}
\vspace{6pt}
\begin{center}
\flatcompare[oucpine][oucred]{优势}{响应快、成本低、易于维护}{不足}{精度受限、依赖数据质量}
\end{center}
\end{frame}
\subsection{块}
\begin{frame}