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.cls228
1 files changed, 128 insertions, 100 deletions
diff --git a/Master/texmf-dist/tex/latex/bithesis/bithesis.cls b/Master/texmf-dist/tex/latex/bithesis/bithesis.cls
index 39141be5f46..4cdb085a59c 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-30}{3.7.9}{BIT Thesis Templates}
+{2024-10-07}{3.8.0}{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
@@ -264,10 +264,12 @@
{toc} {目\label_space: 录} {Table~of~Contents},
{abstract} {摘\label_space: 要} {Abstract},
{conclusion} {结\label_space: 论} {Conclusions},
+ % 附录部分的总标题
{appendix} {附\label_space: 录} {Appendices},
- {ack} {致\label_space: 谢} {Acknowledgement},
+ {ack} {致\label_space: 谢} {Acknowledgements},
{figure} {插\label_space: 图} {Illustrations},
{table} {表\label_space: 格} {Tables},
+ % 附录下各部分编号的前缀
{appendix_prefix} {附录} {Appendix},
{reference} {参考文献} {References},
{university} {北京理工大学} {Beijing~Institute~of~Technology},
@@ -350,7 +352,7 @@
xiheiFont .tl_set:N = \l__bithesis_cover_xihei_font_path_tl,
xiheiFont .default:n = {STXihei},
%% cover entry
- dilimiter .tl_set:N = \l__bithesis_cover_dilimiter_tl,
+ delimiter .tl_set:N = \l__bithesis_cover_delimiter_tl,
labelAlign .tl_set:N = \l__bithesis_cover_label_align_tl,
labelAlign .initial:n = {r},
valueAlign .tl_set:N = \l__bithesis_cover_value_align_tl,
@@ -366,10 +368,20 @@
underlineOffset .dim_set:N = \l__bithesis_cover_underline_offset_dim,
underlineOffset .initial:n = { -10pt },
hideCoverInPeerReview .bool_set:N = \l__bithesis_cover_hide_cover_in_peer_review_bool,
+ % 此处暂且填充默认值为`false`,待确定`\g__bithesis_thesis_type_int`后再根据论文类型覆盖默认值
hideCoverInPeerReview .initial:n = {false},
% 研究生的「特殊类型」
showSpecialTypeBox .bool_set:N = \l__bithesis_cover_show_special_type_box_bool,
- showSpecialTypeBox .initial:n = {false}
+ showSpecialTypeBox .initial:n = {false},
+ % 本科英文模板也可以使用中文封面
+ prefer-zh .bool_set:N = \l__bithesis_cover_prefer_zh_bool,
+ prefer-zh .initial:n = {false},
+ % 本科英文模板使用中文封面时可能需要调换中英文标题顺序
+ reverse-titles .bool_set:N = \l__bithesis_cover_reverse_titles_bool,
+ reverse-titles .initial:n = {false},
+ % 本科英文模板可加入中文标题
+ addTitleZh .bool_set:N = \l__bithesis_cover_add_titlezh_bool,
+ addTitleZh .initial:n = {true},
}
\keys_define:nn { bithesis / info }
{
@@ -491,6 +503,7 @@
autoref .meta:nn = { bithesis / const / autoref } { #1 },
style .meta:nn = { bithesis / const / style } { #1 },
info .meta:nn = { bithesis / const / info } { #1 },
+ heading .meta:nn = { bithesis / const / heading } { #1 },
}
\keys_define:nn { bithesis / const / autoref }
{
@@ -543,6 +556,13 @@
}
},
}
+\keys_define:nn { bithesis / const / heading }
+ {
+ acknowledgements .tl_set:N = \g__bithesis_const_heading_acknowledgements_tl,
+ acknowledgements .initial:n = {
+ \__bithesis_get_const:N {ack}
+ },
+ }
\keys_define:nn { bithesis / style }
{
head .tl_set:N = \l__bithesis_style_head_tl,
@@ -561,6 +581,10 @@
{ \flushbottom }
},
pageVerticalAlign .initial:n = {top},
+ non-CJK-font-in-headings .choice:,
+ non-CJK-font-in-headings / serif .code:n = { \bool_set_false:N \l__bithesis_arial_as_title_font_bool },
+ non-CJK-font-in-headings / sans .code:n = { \bool_set_true:N \l__bithesis_arial_as_title_font_bool },
+ non-CJK-font-in-headings .initial:n = {serif},
% 数学字体配置
mathFont .choices:nn = {
asana, bonum, cm, concrete, dejavu, erewhon, euler,
@@ -586,10 +610,16 @@
}
\keys_define:nn { bithesis / TOC }
{
+ title .tl_set:N = \l__bithesis_toc_title_tl,
+ title .initial:n = {
+ \__bithesis_get_const:N {toc}
+ },
abstract .bool_set:N = \l__bithesis_add_abstract_to_toc_bool,
abstract .initial:n = {true},
abstractEn .bool_set:N = \l__bithesis_add_abstract_en_to_toc_bool,
abstractEn .initial:n = {true},
+ TOC .bool_set:N = \l__bithesis_add_toc_to_toc_bool,
+ TOC .initial:n = {false},
symbols .bool_set:N = \l__bithesis_add_symbols_to_toc_bool,
symbols .initial:n = {true},
}
@@ -620,6 +650,11 @@
minbibnames .initial:n = {10},
}
\ProcessKeysOptions { bithesis / option }
+\__bithesis_if_graduate:TF {
+ \keys_set:nn {bithesis} {cover/hideCoverInPeerReview = false}
+} {
+ \keys_set:nn {bithesis} {cover/hideCoverInPeerReview = true}
+}
\__bithesis_if_thesis_english:T {
\PassOptionsToClass{scheme=plain}{ctexbook}
}
@@ -639,6 +674,7 @@
\RequirePackage{geometry}
\RequirePackage[table,xcdraw]{xcolor}
\RequirePackage{xeCJK}
+\RequirePackage[bodytextleadingratio=1.56]{zhlineskip}
\RequirePackage{titletoc}
\RequirePackage{graphicx}
\RequirePackage{fancyhdr}
@@ -793,21 +829,20 @@
}
}
- \__bithesis_if_thesis_english:TF {
+ \bool_if:NTF \l__bithesis_arial_as_title_font_bool {
+ % 手动指定时要加载 Arial
+ \newfontfamily\arialfamily{Arial}
+ } {
+ % 即使未指定,本科全英文专业模板的声明也需要 Arial
\__bithesis_if_thesis_int_type:nT {3} {
- % 对于本科全英文专业模板
- % Font Arial is needed.
\newfontfamily\arialfamily{Arial}
}
-
- } {
- % 对于其他的中文模板,
- % 需要加载细黑体。
- \tl_if_blank:VTF \l__bithesis_cover_xihei_font_path_tl {}
- {
- \setCJKfamilyfont{xihei}[AutoFakeBold,AutoFakeSlant]
- {\l__bithesis_cover_xihei_font_path_tl}
- }
+ }
+ % 无论中英文,封面都可能需要细黑体。
+ \tl_if_blank:VTF \l__bithesis_cover_xihei_font_path_tl {}
+ {
+ \setCJKfamilyfont{xihei}[AutoFakeBold,AutoFakeSlant]
+ {\l__bithesis_cover_xihei_font_path_tl}
}
% 对于本科全英文专业模板,需要自定义日期格式。
@@ -916,10 +951,12 @@
}
}
\cs_new:Npn \l__bithesis_title_font_cs:n #1 {
- \int_compare:nNnTF {\g__bithesis_thesis_type_int} = {3}
+ \bool_if:NTF \l__bithesis_arial_as_title_font_bool
{
- \arialfamily #1
+ % 即使是英文模板,仍可能出现中文,也需设置中文字体。
+ \heiti\arialfamily #1
} {
+ % 西文保持原本的 Times New Roman。黑体一般不搭配衬线体,但学校要求如此。
\heiti #1
}
}
@@ -1046,13 +1083,7 @@
{\tablename~\thecontentslabel\quad}{\hspace*{-1.5cm}}
{\hspace{.5em}\titlerule*{.}\contentspage}
\RenewDocumentCommand \frontmatter {} {
- \int_compare:nNnTF {\g__bithesis_thesis_type_int} = {3}
- {
- % 本科全英文专业论文,页码使用小罗马数字。
- \pagenumbering{roman}
- } {
- \pagenumbering{Roman}
- }
+ \pagenumbering{Roman}
% 这部分的章节标题不进行编号。
\ctexset{
chapter = {
@@ -1273,7 +1304,7 @@
\ooalign{\copy0\cr\rule[\dimexpr#1-#2\relax]{\wd0}{#2}}}}
\cs_new:Npn \__bithesis_render_cover_entry:nn #1#2 {
\makebox[\l__bithesis_cover_label_max_width_dim][\l__bithesis_cover_label_align_tl]{
- \tl_if_blank:VTF #1 {} {#1\l__bithesis_cover_dilimiter_tl}
+ \tl_if_blank:VTF #1 {} {#1\l__bithesis_cover_delimiter_tl}
}
\hspace{1ex}
\__bithesis_dunderline:nnn{\l__bithesis_cover_underline_offset_dim}
@@ -1452,8 +1483,8 @@
{
\renewcommand{\baselinestretch}{2}
- \tl_if_empty:NT \l__bithesis_cover_dilimiter_tl {
- \tl_set:Nn \l__bithesis_cover_dilimiter_tl {\qquad}
+ \tl_if_empty:NT \l__bithesis_cover_delimiter_tl {
+ \tl_set:Nn \l__bithesis_cover_delimiter_tl {\qquad}
}
\tl_set:Nn \l__bithesis_cover_underline_offset_dim {-5pt}
@@ -1502,8 +1533,8 @@
\vskip \stretch{1}
{
- \tl_if_empty:NT \l__bithesis_cover_dilimiter_tl {
- \tl_set:Nn \l__bithesis_cover_dilimiter_tl {:~}
+ \tl_if_empty:NT \l__bithesis_cover_delimiter_tl {
+ \tl_set:Nn \l__bithesis_cover_delimiter_tl {:~}
}
\tl_set:Nn \l__bithesis_cover_label_align_tl {l}
@@ -1644,7 +1675,15 @@
\begin{blindPeerReview}[\l__bithesis_cover_hide_cover_in_peer_review_bool]
\group_begin:
- \int_case:nn {\g__bithesis_thesis_type_int}
+ % 封面使用的 thesis-type 可能与整体不同。
+ \int_new:N \l__bithesis_thesis_type_int
+ \bool_if:NTF \l__bithesis_cover_prefer_zh_bool {
+ \int_set:Nn \l__bithesis_thesis_type_int {1}
+ } {
+ \int_set:Nn \l__bithesis_thesis_type_int \g__bithesis_thesis_type_int
+ }
+
+ \int_case:nn {\l__bithesis_thesis_type_int}
{
{1}
{
@@ -1662,22 +1701,33 @@
\zihao{-0}\textbf{\ziju{0.12}\songti{\l__bithesis_style_headline_tl}}\par
- \vspace{16mm}
+ \vspace{0.5em plus 1fill}
- \zihao{2}\textbf{\xihei:n \l__bithesis_value_title_tl}\par
-
- \vspace{3mm}
+ \group_begin:
+ % 中文标题
+ \tl_set:Nn \l_tmpa_tl {
+ \linespread{1.46}\selectfont
+ \zihao{2}\textbf{\xihei:n \l__bithesis_value_title_tl}\par
+ }
+ % 英文标题
+ \tl_set:Nn \l_tmpb_tl {
+ \linespread{1.65}\selectfont
+ \zihao{3}\textbf{\l__bithesis_value_title_en_tl}\par
+ }
- \begin{spacing}{1.2}
- \zihao{3}\selectfont{\textbf{\l__bithesis_value_title_en_tl}}\par
- \end{spacing}
+ \bool_if:NTF \l__bithesis_cover_reverse_titles_bool {
+ \l_tmpb_tl \vspace{3mm} \l_tmpa_tl
+ } {
+ \l_tmpa_tl \vspace{3mm} \l_tmpb_tl
+ }
+ \group_end:
- \vspace{15mm}
+ \vspace{0em plus 1fill}
\begin{spacing}{1.8}
\begin{center}
- \tl_if_empty:NT \l__bithesis_cover_dilimiter_tl {
- \tl_set:Nn \l__bithesis_cover_dilimiter_tl {:}
+ \tl_if_empty:NT \l__bithesis_cover_delimiter_tl {
+ \tl_set:Nn \l__bithesis_cover_delimiter_tl {:}
}
% if not auto width, try override width
\bool_if:NF \l__bithesis_cover_auto_width_bool {
@@ -1709,10 +1759,12 @@
\end{center}
\end{spacing}
- \vspace*{\fill}
+ \vspace*{1.5em plus 1.5fill}
\centering
\zihao{3}\ziju{0.5}\songti{
\tl_if_empty:NTF \l__bithesis_cover_date_tl {
+ % 英文模板中 ctex 不会预设日期格式,但仍要保证中文封面的日期按中文习惯
+ \ctexset{today=small}
\today
} {
\l__bithesis_cover_date_tl
@@ -1740,7 +1792,7 @@
\begin{spacing}{1.8}
- \tl_set:Nn \l__bithesis_cover_dilimiter_tl {\textbf{:}}
+ \tl_set:Nn \l__bithesis_cover_delimiter_tl {\textbf{:}}
\bool_set_false:N \l__bithesis_cover_auto_width_bool
\dim_set:Nn \l__bithesis_cover_label_max_width_dim {35mm}
\dim_set:Nn \l__bithesis_cover_value_max_width_dim {115mm}
@@ -1772,8 +1824,8 @@
\vspace{\stretch{0.67}}
\begin{spacing}{1.8}
- \tl_if_empty:NT \l__bithesis_cover_dilimiter_tl {
- \tl_set:Nn \l__bithesis_cover_dilimiter_tl {:}
+ \tl_if_empty:NT \l__bithesis_cover_delimiter_tl {
+ \tl_set:Nn \l__bithesis_cover_delimiter_tl {:}
}
% 如果不是自动计算宽度,且用户没有自定义宽度,
@@ -1823,14 +1875,19 @@
\vspace{18mm}
+ \bool_if:NT \l__bithesis_cover_add_titlezh_bool {
+ \zihao{2}\textbf{\xihei:n \l__bithesis_value_title_tl}\par
+ \vspace{16mm}
+ }
+
\zihao{2}\textbf{\xihei:n \l__bithesis_value_title_en_tl}\par
\vspace{10mm}
\begin{spacing}{1.8}
\begin{center}
- \tl_if_empty:NT \l__bithesis_cover_dilimiter_tl {
- \tl_set:Nn \l__bithesis_cover_dilimiter_tl {:}
+ \tl_if_empty:NT \l__bithesis_cover_delimiter_tl {
+ \tl_set:Nn \l__bithesis_cover_delimiter_tl {:}
}
% if not auto width, try override width
@@ -1847,7 +1904,7 @@
\clist_set:Nn \l__bithesis_input_clist {
{\c__bithesis_label_school_en_tl} {\l__bithesis_value_school_tl},
- {\c__bithesis_label_major_en_tl} {\l__bithesis_value_major_tl},
+ {\g__bithesis_const_info_major_tl} {\l__bithesis_value_major_tl},
{\c__bithesis_label_author_en_tl} {\l__bithesis_value_author_tl},
{\c__bithesis_label_student_id_en_tl} {\l__bithesis_value_student_id_tl},
{\c__bithesis_label_supervisor_en_tl} {\l__bithesis_value_supervisor_tl},
@@ -1936,7 +1993,10 @@
\newpage
}
{3} {
- \linespread{1.26}\selectfont
+ \currentpdfbookmark{Statements}{frontmatter:originality}
+ \pagestyle{BIThesis}
+ \pagenumbering{gobble}
+
% 原创性声明部分
\begin{center}
\vspace*{-2bp}
@@ -1947,7 +2007,7 @@
}
\end{center}~\par
- % 本部分字号为小三
+ % 本部分字号为小四
\zihao{-4}
\c__bithesis_bachelor_english_label_originality_clause_tl
@@ -1955,7 +2015,7 @@
Student~(Signature):~\dunderline[-1pt]{1pt}{\makebox[18mm]{}}~Date:\par
- \vspace{6mm}
+ \vspace{\stretch{1}}
% 使用授权声明部分
\begin{center}
@@ -2017,12 +2077,6 @@
\renewcommand{\baselinestretch}{1.56}
}
- \__bithesis_if_thesis_english:TF {
- \tl_set:Nn \l__bithesis_toc_title_tl {\c__bithesis_label_toc_en_tl}
- } {
- \tl_set:Nn \l__bithesis_toc_title_tl {\c__bithesis_label_toc_tl}
- }
-
% 自定义目录样式
\cs_set:Npn \contentsname {
\fontsize{16pt}{\baselineskip}
@@ -2032,19 +2086,19 @@
\vspace{-8pt}
}
- % 添加目录书签
- \__bithesis_if_thesis_int_type:nF {3} {
- \currentpdfbookmark{\c__bithesis_label_toc_tl}{ch:toc}
+ \bool_if:NTF \l__bithesis_add_toc_to_toc_bool {
+ % 添加「目录」本身到目录中,同时自动添加书签
+ % 此处必须有`\phantomsection`,不然 hyperref 会把链接指向之前摘要的标题。
+ \phantomsection
+ \addcontentsline{toc}{chapter}{\c__bithesis_label_toc_en_tl}
+ } {
+ % 手动添加目录书签
+ \currentpdfbookmark{\l__bithesis_toc_title_tl}{ch:toc}
}
% 制作目录
\tableofcontents
- % 在本科生全英文模板中,添加「目录」本身到目录中。
- \__bithesis_if_thesis_int_type:nT {3} {
- \addcontentsline{toc}{chapter}{\c__bithesis_label_toc_en_tl}
- }
-
% 单独成页
\clearpage
}
@@ -2076,16 +2130,8 @@
}
\__bithesis_if_bachelor_thesis:T {
- \int_compare:nNnTF {\g__bithesis_thesis_type_int} = {3}
- {
- \ctexset{
- chapter/titleformat = {\heiti}
- }
- }
- {
- \ctexset{
- chapter/titleformat = {\textmd}
- }
+ \ctexset{
+ chapter/titleformat = {\textmd}
}
}
@@ -2124,11 +2170,8 @@
\centering
\vspace*{-2bp}
- \__bithesis_if_thesis_int_type:nTF {3} {
- \arialfamily\zihao{-2}\textbf
- \l__bithesis_value_title_en_tl\\
- } {
- \heiti\zihao{3}\textbf
+ \l__bithesis_title_font_cs:n {
+ \zihao{3}\textbf
\l__bithesis_value_title_en_tl\\
}
\end{spacing}
@@ -2140,19 +2183,8 @@
}
\__bithesis_if_bachelor_thesis:TF {
- \int_compare:nNnTF {\g__bithesis_thesis_type_int} = {3}
- {
- \ctexset{
- chapter = {
- titleformat = {\heiti\zihao{3}\centering\textbf},
- }
- }
- } {
- \ctexset{
- chapter = {
- titleformat = {\heiti\zihao{-3}\centering\textmd},
- }
- }
+ \ctexset{
+ chapter/titleformat = {\zihao{-3}\textmd}
}
} {
\ctexset {
@@ -2253,7 +2285,7 @@
}
\bool_if:NTF \l__bithesis_appendices_chapter_level_bool {
- % 附录章节级别
+ % 使用以「chapter」为顶层的附录格式
% 仅设置 \setcounter{chapter}{0} 时,pdf 目录会索引到正文章节。
% 因此,需要使用 \appendix 重置计数器,并将附录后面的
@@ -2272,7 +2304,7 @@
\Alph{chapter}
}
} {
- % 附录节(section)级别
+ % 使用以「section」为顶层的附录格式
% 因为不需要用到 chapter counter, 所以直接加一即可。
\stepcounter{chapter}
@@ -2323,11 +2355,7 @@
subsubsection/number = \arabic{section}. \arabic{subsection}. \arabic{subsubsection},
}
- \__bithesis_if_thesis_english:TF {
- \chapter{\c__bithesis_label_ack_en_tl}
- } {
- \chapter{\c__bithesis_label_ack_tl}
- }
+ \chapter{\g__bithesis_const_heading_acknowledgements_tl}
\__bithesis_if_graduate:TF {\fangsong}{}
#1
\end{blindPeerReview}