Skip to content

Commit 2f6cf63

Browse files
YDX-2147483647fky2015
authored andcommitted
fix: misc/tabularRowSeparation不应影响矩阵,并适配longtable宏包
Fixes #498 Fixes #501
1 parent 2f6bf7e commit 2f6cf63

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

bithesis-doc.tex

+6-2
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ \subsubsection{其他配置}
12361236
在 Windows 和 MacOS 中,该字体已经安装;在 Linux 中需要用户自行安装(如果你是 WSL 用户,可参照\ref{sec:word-fonts}直接使用 Windows 下的字体)。
12371237
\end{function}
12381238

1239-
\begin{function}[added=2023-04-22]{misc/tabularFontSize}
1239+
\begin{function}[added=2023-04-22, updated=2024-05-13]{misc/tabularFontSize}
12401240
\begin{bitsyntax}[emph={[1]tabularFontSize}]
12411241
tabularFontSize = (*(5)|其他字号*)
12421242
\end{bitsyntax}
@@ -1248,6 +1248,8 @@ \subsubsection{其他配置}
12481248
如果你需要临时调整表格中的字号,可以使用 |\BITSetup| 命令
12491249
在局部范围内覆盖此选项(注意使用大括号)。
12501250

1251+
此选项影响的“表格”具体包括标准 |tabular|、|tabular*| 环境,以及 |tabularx| 和 |longtable| 宏包提供的环境。
1252+
12511253
\begin{latex}
12521254
{
12531255
\BITSetup{ misc / tabularFontSize = -4}
@@ -1332,7 +1334,7 @@ \subsubsection{其他配置}
13321334

13331335
\end{function}
13341336

1335-
\begin{function}[added=2024-04-30]{misc/tabularRowSeparation}
1337+
\begin{function}[added=2024-04-30, updated=2024-05-13]{misc/tabularRowSeparation}
13361338
\begin{bitsyntax}[emph={[1]tabularRowSeparation}]
13371339
tabularRowSeparation = (*(1)|\marg{正实数}*)
13381340
\end{bitsyntax}
@@ -1343,6 +1345,8 @@ \subsubsection{其他配置}
13431345

13441346
学校没有明文规定,不过设为1.25更接近本科Word模板实作,设为1.6更接近硕博Word模板实作。
13451347

1348+
此选项影响的“表格”具体包括标准 |tabular|、|tabular*| 环境,以及 |tabularx| 宏包提供的环境。并不影响 |longtable| 宏包提供的环境,因为宏包已经调节了。
1349+
13461350
\textit{请在导言区使用此选项。}
13471351

13481352
\end{function}

bithesis.dtx

+20-6
Original file line numberDiff line numberDiff line change
@@ -1461,6 +1461,8 @@
14611461
{\hspace{.5em}\titlerule*{.}\contentspage}
14621462
% \end{macrocode}
14631463
%
1464+
% \subsubsection{定义样式相关函数}
1465+
%
14641466
% \begin{macro}{\frontmatter}
14651467
% 定义前置内容的页面样式。
14661468
% \begin{macrocode}
@@ -1481,17 +1483,31 @@
14811483
\linespread{1.53}\selectfont
14821484
\pagestyle{BIThesis}
14831485

1484-
% 表格内容默认使用五号字
1486+
% 调整表格内容字号(默认五号)和各行之间的距离
14851487
%
14861488
% 由于这种方式会影响所有的表格,
14871489
% 所以我们尽可能延迟这种影响。
14881490
%
14891491
% 不过,在目前的代码实现中没有在封面
14901492
% 之类的地方使用表格,所以目前即使放在
14911493
% preamble 中也不会有影响。
1492-
\AtBeginEnvironment{tabular}{\zihao{\l_@@_misc_tabular_font_size_tl}}
1493-
\AtBeginEnvironment{tabular*}{\zihao{\l_@@_misc_tabular_font_size_tl}}
1494-
\AtBeginEnvironment{tabularx}{\zihao{\l_@@_misc_tabular_font_size_tl}}
1494+
%
1495+
% 支持标准tabular、tabular*环境和宏包tabularx、longtable。
1496+
\clist_map_inline:nn
1497+
{tabular, tabular*, tabularx, longtable}
1498+
{
1499+
\AtBeginEnvironment {##1} {
1500+
% 字号只想设置表格内容,不想影响caption。
1501+
% 一般caption在环境之外,自然不受影响;
1502+
% 而longtable的caption虽在环境内,但caption宏包能正常处理。
1503+
\zihao{\l_@@_misc_tabular_font_size_tl}
1504+
% 各行间距只想影响表格,不想影响矩阵,因此也必须在钩子中设置。
1505+
% 另外,longtable宏包已经调节了空隙,我们就不重复调节了。
1506+
\str_if_eq:nnF {##1} {longtable} {
1507+
\cs_set:Npn \arraystretch {\l_@@_misc_tabular_row_separation_tl}
1508+
}
1509+
}
1510+
}
14951511
}
14961512
% \end{macrocode}
14971513
% \end{macro}
@@ -1632,8 +1648,6 @@
16321648
% 调整浮动体与文字之间的距离
16331649
\addtolength{\intextsep}{\l_@@_misc_float_separation_tl\baselineskip}
16341650
\addtolength{\textfloatsep}{\l_@@_misc_float_separation_tl\baselineskip}
1635-
% 调整表格各行之间的距离
1636-
\cs_set:Npn \arraystretch {\l_@@_misc_tabular_row_separation_tl}
16371651
}
16381652
% \end{macrocode}
16391653
% \end{macro}

0 commit comments

Comments
 (0)