fix(preamble): \paragraph 改 block 编号标题并修紧邻公式间距

\paragraph 默认 run-in,紧跟显示公式时孤立标题保留 \parindent
渲染成缩进错位;改 [block] 独占一行左对齐,并加独立阿拉伯编号
(secnumdepth=4、\theparagraph 裸号、subsection 亦归零)。
另:align 等多行环境不走 $$,紧贴标题会多出一行空白,新增
\tightalign(负一行)抵消,D.8 处用之以保留 align 让编号贴末行。
This commit is contained in:
2026-06-17 18:19:36 +08:00
parent c31e17e2bc
commit da4c50e158
2 changed files with 28 additions and 9 deletions
+18
View File
@@ -28,6 +28,11 @@
\newcommand{\Herm}{\mathsf{H}}
\newcommand{\diff}{\mathop{}\!\mathrm{d}}
\newcommand{\appref}[1]{附录~\ref{#1}}
% align/gather 等 amsmath 多行环境不走 TeX 原生 $$,紧贴标题(垂直模式起排)时会比
% equation/\[\] 多出约一行空白(后者借 $$ 的 \predisplaysize 特判吸收掉行首间距)。
% 当需要编号贴在末行、不能用 equation+aligned(其号垂直居中)时,在标题与该公式之间
% 插入 \tightalign 抵消多出的一行。
\newcommand{\tightalign}{\vspace*{-\baselineskip}}
\usepackage{arydshln}
@@ -85,6 +90,19 @@
\titlespacing*{\section}{0pt}{*0}{*0} % 左边缩进 = 0pt,上间距 = 0,下间距 = 0
\titlespacing*{\subsection}{0pt}{*0}{*0} % 左边缩进 = 0pt,上间距 = 0,下间距 = 0
\titlespacing*{\subsubsection}{0pt}{*0}{*0} % 左边缩进 = 0pt,上间距 = 0,下间距 = 0
% \paragraph 默认为 run-in 标题(其文字延迟到下一段 \everypar 注入)。当其后紧跟
% 显示公式(无正文可并入)时,孤立标题会成为段首行并保留 \parindent,渲染成缩进/居中
% 错位;改为 block 形状即标题独占一行、左对齐,与其余标题层级一致。
% 第 4 级标题用独立阿拉伯编号(1. 2. …),不挂上级号以免出现 D.1.1.1 这种过深编号;
% 计数器在 subsection 与 subsubsection 两级均归零(默认只随 subsubsection 归零,
% 但 F.4 等直接挂 subsection 的情形需补上 subsection 触发)。
\setcounter{secnumdepth}{4}
\renewcommand{\theparagraph}{\arabic{paragraph}}
\makeatletter
\@addtoreset{paragraph}{subsection}
\makeatother
\titleformat{\paragraph}[block]{\normalfont\normalsize\bfseries}{\theparagraph.}{0.5em}{}
\titlespacing*{\paragraph}{0pt}{*0}{*0}
\usepackage[acronym]{glossaries}
\glsdisablehyper%