Skip to content

Commit

Permalink
feat: misc/algorithmSeparation选项调整算法与文字之间的距离(仅针对algorithm2e宏包)
Browse files Browse the repository at this point in the history
Fixes #494

BREAKING CHANGE: 如果您使用了algorithm2e宏包,距离会从约3点增大到约12点。
  • Loading branch information
YDX-2147483647 authored and fky2015 committed May 22, 2024
1 parent 8673d0a commit 0bffec6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bithesis-doc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,23 @@ \subsubsection{其他配置}

\end{function}

\begin{function}[added=2024-05-20]{misc/algorithmSeparation}
\begin{bitsyntax}[emph={[1]algorithmSeparation}]
floatSeparation = (*(12pt plus 4pt minus 4pt)|\marg{长度}*)
\end{bitsyntax}

\textit{此选项一般不需要用户自行修改。}

此选项用于调整算法与正文之间的距离。距离用\href{https://www.overleaf.com/learn/latex/Lengths_in_LaTeX}{长度}表示,例如 |0.5em| 大致是半个字高。默认值更复杂一些,它表示以12点为基准,允许上下浮动4点。

(学校既无明文规定,也无实例。)

此选项目前只支持 |algorithm2e| 宏包的 |algorithm| 环境。

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

\end{function}

\begin{function}[added=2024-04-30, updated=2024-05-13]{misc/tabularRowSeparation}
\begin{bitsyntax}[emph={[1]tabularRowSeparation}]
tabularRowSeparation = (*(1)|\marg{正实数}*)
Expand Down
8 changes: 8 additions & 0 deletions bithesis.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,8 @@
% 浮动体相关的各种间距
floatSeparation .tl_set:N = \l_@@_misc_float_separation_tl,
floatSeparation .initial:n = {0},
algorithmSeparation .tl_set:N = \l_@@_misc_algorithm_separation_tl,
algorithmSeparation .initial:n = {12pt plus 4pt minus 4pt},
tabularRowSeparation .tl_set:N = \l_@@_misc_tabular_row_separation_tl,
tabularRowSeparation .initial:n = {1},
}
Expand Down Expand Up @@ -1648,6 +1650,12 @@
% 调整浮动体与文字之间的距离
\addtolength{\intextsep}{\l_@@_misc_float_separation_tl\baselineskip}
\addtolength{\textfloatsep}{\l_@@_misc_float_separation_tl\baselineskip}
% 调整算法与文字之间的距离
% 针对 algorithm2e 宏包
\@ifpackageloaded{algorithm2e}{
% 宏包手册介绍可自定义宏,再`\SetAlgoSkip`;我们为简洁,直接覆写。
\renewcommand{\@algoskip}{\vspace{\l_@@_misc_algorithm_separation_tl}}
}{}
}
% \end{macrocode}
% \end{macro}
Expand Down

0 comments on commit 0bffec6

Please sign in to comment.