Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 适配longtable宏包 #513

Merged
merged 3 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bithesis-doc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,7 @@ \subsubsection{其他配置}

\end{function}

\begin{function}[added=2024-04-30, updated=2024-05-13]{misc/tabularRowSeparation}
\begin{function}[added=2024-04-30, updated=2024-05-25]{misc/tabularRowSeparation}
\begin{bitsyntax}[emph={[1]tabularRowSeparation}]
tabularRowSeparation = (*(1)|\marg{正实数}*)
\end{bitsyntax}
Expand All @@ -1362,7 +1362,7 @@ \subsubsection{其他配置}

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

此选项影响的“表格”具体包括标准 |tabular|、|tabular*| 环境,以及 |tabularx| 宏包提供的环境。并不影响 |longtable| 宏包提供的环境,因为宏包已经调节了
此选项影响的“表格”具体包括标准 |tabular|、|tabular*| 环境,以及 |tabularx| |longtable| 宏包提供的环境。

\textit{请在导言区使用此选项。}

Expand Down
24 changes: 20 additions & 4 deletions bithesis.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,13 @@
\setlength{\intextsep}{1.80\baselineskip plus 0.2\baselineskip minus 0.2\baselineskip}
% 浮动体位于页面顶部或底部时,调整浮动体与正文之间的距离,后或前加上一行空白
\setlength{\textfloatsep}{1.80\baselineskip plus 0.2\baselineskip minus 0.2\baselineskip}
\AtBeginDocument {
% longtable 宏包有另外的机制,需专门调整
\@ifpackageloaded{longtable}{
\setlength{\LTpre}{0.60\baselineskip plus 0.2\baselineskip minus 0.2\baselineskip}
\setlength{\LTpost}{1.60\baselineskip plus 0.2\baselineskip minus 0.2\baselineskip}
}{}
}
}
% \end{macrocode}
%
Expand Down Expand Up @@ -1495,6 +1502,10 @@
% preamble 中也不会有影响。
%
% 支持标准tabular、tabular*环境和宏包tabularx、longtable。
%
% 为保证各种表格效果一致,要先手动重置setspace宏包漏掉的longtable;
\AtBeginEnvironment {longtable} {\singlespacing}
% 之后再统一设置。
\clist_map_inline:nn
{tabular, tabular*, tabularx, longtable}
{
Expand All @@ -1504,10 +1515,7 @@
% 而longtable的caption虽在环境内,但caption宏包能正常处理。
\zihao{\l_@@_misc_tabular_font_size_tl}
% 各行间距只想影响表格,不想影响矩阵,因此也必须在钩子中设置。
% 另外,longtable宏包已经调节了空隙,我们就不重复调节了。
\str_if_eq:nnF {##1} {longtable} {
\cs_set:Npn \arraystretch {\l_@@_misc_tabular_row_separation_tl}
}
\cs_set:Npn \arraystretch {\l_@@_misc_tabular_row_separation_tl}
}
}
}
Expand Down Expand Up @@ -1579,6 +1587,9 @@
% 至于表格,虽然其caption位置在上方(而图片是在下方),
% 但 `caption` 宏包已考虑这种区别,统一设置 `belowskip` 即可。
\captionsetup{belowskip=-5pt}
% 不过 longtable 宏包有另外的机制,不设置 belowskip 时间距已可较小,
% 设置成负数还导致 caption 和表格本体的距离变大。因此我们撤销更改。
\captionsetup[longtable]{belowskip=0pt}

% 此外在浮动体内部,调整表格 caption 和表格本体间的距离。
% 本来默认有一定空隙,现改为紧贴,这样更接近Word模板实作。
Expand Down Expand Up @@ -1650,6 +1661,11 @@
% 调整浮动体与文字之间的距离
\addtolength{\intextsep}{\l_@@_misc_float_separation_tl\baselineskip}
\addtolength{\textfloatsep}{\l_@@_misc_float_separation_tl\baselineskip}
% longtable 宏包有另外的机制,需专门调整
\@ifpackageloaded{longtable}{
\addtolength{\LTpre}{\l_@@_misc_float_separation_tl\baselineskip}
\addtolength{\LTpost}{\l_@@_misc_float_separation_tl\baselineskip}
}{}
% 调整算法与文字之间的距离
% 针对 algorithm2e 宏包
\@ifpackageloaded{algorithm2e}{
Expand Down