summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bithesis/bithesis.cls
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/bithesis/bithesis.cls')
-rw-r--r--Master/texmf-dist/tex/latex/bithesis/bithesis.cls98
1 files changed, 74 insertions, 24 deletions
diff --git a/Master/texmf-dist/tex/latex/bithesis/bithesis.cls b/Master/texmf-dist/tex/latex/bithesis/bithesis.cls
index 373034e9c7a..39141be5f46 100644
--- a/Master/texmf-dist/tex/latex/bithesis/bithesis.cls
+++ b/Master/texmf-dist/tex/latex/bithesis/bithesis.cls
@@ -27,7 +27,7 @@
%%
\RequirePackage{expl3,l3keys2e}
\ProvidesExplClass{bithesis}
-{2024-05-04}{3.7.7}{BIT Thesis Templates}
+{2024-05-30}{3.7.9}{BIT Thesis Templates}
\int_new:N \g__bithesis_thesis_type_int
\int_new:N \g__bithesis_head_zihao_int
\bool_new:N \g__bithesis_twoside_bool
@@ -79,6 +79,7 @@
\cs_new:Npn \__bithesis_if_thesis_int_type:nTF #1#2#3 {\int_compare:nNnTF {\g__bithesis_thesis_type_int} = {#1} {#2} {#3}}
\cs_new:Npn \__bithesis_if_thesis_int_type:nT #1#2 {\__bithesis_if_thesis_int_type:nTF {#1} {#2} {}}
+\cs_new:Npn \__bithesis_if_thesis_int_type:nF #1#2 {\__bithesis_if_thesis_int_type:nTF {#1} {} {#2}}
\cs_new:Npn \__bithesis_if_thesis_english:TF #1#2 {\bool_if:nTF {\g__bithesis_thesis_type_english_bool} {#1} {#2}}
\cs_new:Npn \__bithesis_if_thesis_english:T #1 {\__bithesis_if_thesis_english:TF {#1}{}}
@@ -480,6 +481,8 @@
% 浮动体相关的各种间距
floatSeparation .tl_set:N = \l__bithesis_misc_float_separation_tl,
floatSeparation .initial:n = {0},
+ algorithmSeparation .tl_set:N = \l__bithesis_misc_algorithm_separation_tl,
+ algorithmSeparation .initial:n = {12pt plus 4pt minus 4pt},
tabularRowSeparation .tl_set:N = \l__bithesis_misc_tabular_row_separation_tl,
tabularRowSeparation .initial:n = {1},
}
@@ -693,6 +696,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}
+ }{}
+ }
}
\ctex_at_end_preamble:n {
\bool_if:NTF \l__bithesis_style_better_new_roman_bool {
@@ -1052,7 +1062,7 @@
\linespread{1.53}\selectfont
\pagestyle{BIThesis}
- % 表格内容默认使用五号字。
+ % 调整表格内容字号(默认五号)和各行之间的距离。
%
% 由于这种方式会影响所有的表格,
% 所以我们尽可能延迟这种影响。
@@ -1060,9 +1070,24 @@
% 不过,在目前的代码实现中没有在封面
% 之类的地方使用表格,所以目前即使放在
% preamble 中也不会有影响。
- \AtBeginEnvironment{tabular}{\zihao{\l__bithesis_misc_tabular_font_size_tl}}
- \AtBeginEnvironment{tabular*}{\zihao{\l__bithesis_misc_tabular_font_size_tl}}
- \AtBeginEnvironment{tabularx}{\zihao{\l__bithesis_misc_tabular_font_size_tl}}
+ %
+ % 支持标准tabular、tabular*环境和宏包tabularx、longtable。
+ %
+ % 为保证各种表格效果一致,要先手动重置setspace宏包漏掉的longtable;
+ \AtBeginEnvironment {longtable} {\singlespacing}
+ % 之后再统一设置。
+ \clist_map_inline:nn
+ {tabular, tabular*, tabularx, longtable}
+ {
+ \AtBeginEnvironment {##1} {
+ % 字号只想设置表格内容,不想影响caption。
+ % 一般caption在环境之外,自然不受影响;
+ % 而longtable的caption虽在环境内,但caption宏包能正常处理。
+ \zihao{\l__bithesis_misc_tabular_font_size_tl}
+ % 各行间距只想影响表格,不想影响矩阵,因此也必须在钩子中设置。
+ \cs_set:Npn \arraystretch {\l__bithesis_misc_tabular_row_separation_tl}
+ }
+ }
}
\RenewDocumentCommand \mainmatter {} {
% 另起一个空页,以便于后续的章节标题编号。
@@ -1115,6 +1140,9 @@
% 至于表格,虽然其caption位置在上方(而图片是在下方),
% 但 `caption` 宏包已考虑这种区别,统一设置 `belowskip` 即可。
\captionsetup{belowskip=-5pt}
+ % 不过 longtable 宏包有另外的机制,不设置 belowskip 时间距已可较小,
+ % 设置成负数还导致 caption 和表格本体的距离变大。因此我们撤销更改。
+ \captionsetup[longtable]{belowskip=0pt}
% 此外在浮动体内部,调整表格 caption 和表格本体间的距离。
% 本来默认有一定空隙,现改为紧贴,这样更接近Word模板实作。
@@ -1173,8 +1201,17 @@
% 调整浮动体与文字之间的距离
\addtolength{\intextsep}{\l__bithesis_misc_float_separation_tl\baselineskip}
\addtolength{\textfloatsep}{\l__bithesis_misc_float_separation_tl\baselineskip}
- % 调整表格各行之间的距离
- \cs_set:Npn \arraystretch {\l__bithesis_misc_tabular_row_separation_tl}
+ % longtable 宏包有另外的机制,需专门调整
+ \@ifpackageloaded{longtable}{
+ \addtolength{\LTpre}{\l__bithesis_misc_float_separation_tl\baselineskip}
+ \addtolength{\LTpost}{\l__bithesis_misc_float_separation_tl\baselineskip}
+ }{}
+ % 调整算法与文字之间的距离
+ % 针对 algorithm2e 宏包
+ \@ifpackageloaded{algorithm2e}{
+ % 宏包手册介绍可自定义宏,再`\SetAlgoSkip`;我们为简洁,直接覆写。
+ \renewcommand{\@algoskip}{\vspace{\l__bithesis_misc_algorithm_separation_tl}}
+ }{}
}
\bool_if:NF \l__bithesis_style_hyphen_bool {
\hbadness=10000
@@ -1338,24 +1375,23 @@
\cleardoublepage
\currentpdfbookmark{书脊}{frontmatter:paperback}
\begin{titlepage}
- \vskip 5cm
- \begin{center}
+ \centering
+ % 实现竖排——将水平宽度设得很窄,让文字自动换行,并改小行距
\linespread{1.1}\selectfont
- \begin{minipage}[t][19.7cm]{2em}
- \begin{center}
- {
- \heiti\zihao{3}
- \tl_if_blank:VTF \l__bithesis_value_vertical_title_tl
- {\l__bithesis_value_title_tl}{\l__bithesis_value_vertical_title_tl}
- }
- \vfill
- {\heiti\zihao{3}\__bithesis_secret_info:nn{\l__bithesis_value_author_tl}{\g__bithesis_const_substitute_symbol_tl\quad\g__bithesis_const_substitute_symbol_tl\quad\g__bithesis_const_substitute_symbol_tl}}
- \vfill
- {\heiti\zihao{3}\c__bithesis_label_university_tl}
- \end{center}
+ \begin{minipage}[c][19.7cm]{2em}
+ \centering
+ {
+ \heiti\zihao{3}
+ \tl_if_blank:VTF \l__bithesis_value_vertical_title_tl
+ {\l__bithesis_value_title_tl}{\l__bithesis_value_vertical_title_tl}
+ }
+ \par
+ \vspace{1em plus 1fill}
+ {\heiti\zihao{3}\__bithesis_secret_info:nn{\l__bithesis_value_author_tl}{\g__bithesis_const_substitute_symbol_tl\quad\g__bithesis_const_substitute_symbol_tl\quad\g__bithesis_const_substitute_symbol_tl}}
+ \par
+ \vspace{1em plus 1fill}
+ {\heiti\zihao{3}\c__bithesis_label_university_tl}
\end{minipage}
- \end{center}
- % \vskip 5cm
\end{titlepage}
}
\cs_new:Npn \__bithesis_make_chinese_title_page: {
@@ -1950,9 +1986,20 @@
}
\NewDocumentCommand \MakePaperBack {}
{
+ % 上下各留出规定的边距,到下一页再恢复。
+ % 若标题超长,自然会向上下溢出。
+ %
+ % 必须在顶层操作,不然影响不确定。
+ % https://tex.stackexchange.com/q/718581
+ %
+ % 单纯`\newgeometry`再`\restoregeometry`相当于仅仅`\clearpage`,也无问题。
+ \newgeometry{
+ vmargin = 5cm,
+ }
\begin{blindPeerReview}[\l__bithesis_cover_hide_cover_in_peer_review_bool]
\make_paper_back:
\end{blindPeerReview}
+ \restoregeometry
}
\NewDocumentCommand \MakeTitle {}
{
@@ -1986,7 +2033,10 @@
}
% 添加目录书签
- \currentpdfbookmark{\c__bithesis_label_toc_tl}{ch:toc}
+ \__bithesis_if_thesis_int_type:nF {3} {
+ \currentpdfbookmark{\c__bithesis_label_toc_tl}{ch:toc}
+ }
+
% 制作目录
\tableofcontents