texlive[74877] Master/texmf-dist: bithesis (8apr25)
commits+karl at tug.org
commits+karl at tug.org
Tue Apr 8 22:11:21 CEST 2025
Revision: 74877
https://tug.org/svn/texlive?view=revision&revision=74877
Author: karl
Date: 2025-04-08 22:11:20 +0200 (Tue, 08 Apr 2025)
Log Message:
-----------
bithesis (8apr25)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/bithesis/bithesis.pdf
trunk/Master/texmf-dist/doc/latex/bithesis/dtx-style.sty
trunk/Master/texmf-dist/source/latex/bithesis/bithesis.dtx
trunk/Master/texmf-dist/source/latex/bithesis/bithesis.ins
trunk/Master/texmf-dist/tex/latex/bithesis/bitbeamer.cls
trunk/Master/texmf-dist/tex/latex/bithesis/bithesis.cls
trunk/Master/texmf-dist/tex/latex/bithesis/bitreport.cls
Modified: trunk/Master/texmf-dist/doc/latex/bithesis/bithesis.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/bithesis/dtx-style.sty
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bithesis/dtx-style.sty 2025-04-08 17:24:11 UTC (rev 74876)
+++ trunk/Master/texmf-dist/doc/latex/bithesis/dtx-style.sty 2025-04-08 20:11:20 UTC (rev 74877)
@@ -6,7 +6,7 @@
%%
%% bithesis.dtx (with options: `dtx-style')
%%
-%% Copyright (C) 2023
+%% Copyright (C) 2025
%% Association of Bit Network Pioneer and any individual authors listed in the documentation.
%% ------------------------------------------------------------------------------
%%
@@ -110,7 +110,8 @@
{LR}{简易实验报告模板(lab-report)}
{PT}{本科生毕业设计外文翻译模板(paper-translation)}
{PS}{北理工主题的 Beamer 模板(presentation-slide)}
- {UP}{本科生毕业设计开题报告(undergraduate-proposal)}
+ {UP}{本科生毕业设计开题报告(undergraduate-proposal,已废弃)}
+ {RR}{本科生读书报告模板(reading-report)}
}
}
@@ -276,7 +277,7 @@
}
\lstnewenvironment{latex}[1][]{\lstset{style=lstStyleLaTeX, #1}}{}
-\lstnewenvironment{shell}{\lstset{style=lstStyleShell}}{}
+\lstnewenvironment{shell}[1][]{\lstset{style=lstStyleShell, #1}}{}
\lstnewenvironment{bitsyntax}[1][]{\lstset{style=lstStyleSyntax, #1}}{}
\def\orbar{\textup{\textbar}}
Modified: trunk/Master/texmf-dist/source/latex/bithesis/bithesis.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/bithesis/bithesis.dtx 2025-04-08 17:24:11 UTC (rev 74876)
+++ trunk/Master/texmf-dist/source/latex/bithesis/bithesis.dtx 2025-04-08 20:11:20 UTC (rev 74877)
@@ -21,10 +21,10 @@
%<thesis>\ProvidesExplClass{bithesis}
%<report>\ProvidesExplClass{bitreport}
%<beamer>\ProvidesExplClass{bitbeamer}
-%<cls>{2025-03-25}{3.8.2}{BIT Thesis Templates}
+%<cls>{2025-04-08}{3.8.3}{BIT Thesis Templates}
%
%<*driver>
-\ProvidesFile{bithesis.dtx}[2025/03/25 3.8.2 BIT Thesis Templates]
+\ProvidesFile{bithesis.dtx}[2025/04/08 3.8.3 BIT Thesis Templates]
\documentclass[letterpaper]{l3doc}
\usepackage{dtx-style}
@@ -199,7 +199,7 @@
}
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\@@_if_graduate:TF}
+% \begin{macro}{\@@_if_graduate:TF,\@@_if_graduate:T}
% 是否为研究生学位论文。
% \begin{macrocode}
\cs_new:Npn \@@_if_graduate:TF #1#2 {
@@ -207,6 +207,7 @@
{#1}
{#2}
}
+\cs_new:Npn \@@_if_graduate:T #1 {\@@_if_graduate:TF {#1} {}}
% \end{macrocode}
% \end{macro}
@@ -345,7 +346,8 @@
{classification} {中图分类号:},
{classified_level} {密级},
{type} {种类},
- {special_type} {特别类型},
+ {special_type} {学生类型},
+ {engineering_special_plan} {工程硕博士专项},
{cross_research} {交叉研究方向},
{international_student_ugp} {政府项目留学生},
}
@@ -453,14 +455,16 @@
% \begin{macrocode}
\clist_map_inline:nn
{
+ % TODO: 自动实现汉字均排
{author} {作\quad 者\quad 姓\quad 名} {Candidate~Name},
{school} {学\quad 院\quad 名\quad 称} {School~or~Department},
{supervisor} {指\quad 导\quad 教\quad 师} {Faculty~Mentor},
+ {industrial_mentor} {行\smallgap: 业\smallgap: 合\smallgap: 作\smallgap: 导\smallgap: 师} {Industry~Collaboration~Mentor},
{chairman} {答辩委员会主席} {Chair,~Thesis~Committee},
- {degree}
- {申\quad 请\quad 学\quad 位}
- {Degree~Applied},
- {major} {学\quad 科\hspace{0.8ex} / \hspace{0.8ex} 类\quad 别} {Major},
+ % degree、major 的中文与 degreeType 有关,此处以 academic 为准,其余情况通过 \c_@@_auto_tl 处理
+ % 英文倒是无关。
+ {degree} {申\quad 请\quad 学\quad 位} {Degree~Applied},
+ {major} {一\quad 级\quad 学\quad 科} {Major},
{institute}
{学\smallgap: 位\smallgap: 授\smallgap: 予\smallgap: 单\smallgap: 位}
{Degree~by},
@@ -545,6 +549,13 @@
%
% \subsubsection{l3keys 接口键值对定义}
%
+% 定义 |\c_@@_auto_tl|
+% 选项设为它时,表示智能默认值,稍后由 |\@@_resolve_auto_values:| 根据其它信息自动填充。
+% 参考 https://typst.app/docs/reference/foundations/auto/ 的设计。
+% \begin{macrocode}
+\tl_const:Nn \c_@@_auto_tl { BIThesis-auto-magic }
+% \end{macrocode}
+%
% 定义 |bithesis| 键值对类。
% \begin{macrocode}
\keys_define:nn { bithesis }
@@ -669,7 +680,15 @@
% UDC 分类号,研究生学位论文使用
UDC .tl_set:N = \l_@@_value_udc_tl,
UDC .initial:n = {540(示例)},
+ % 学术型/专业型,研究生学位论文使用
+ degreeType .choice:,
+ degreeType .choices:nn = {professional, academic} {
+ \tl_set:Nn \l_@@_value_degree_type_tl {#1}
+ },
+ degreeType .initial:n = academic,
chairman .tl_set:N = \l_@@_value_chairman_tl,
+ industrialMentor .tl_set:N = \l_@@_value_industrial_mentor_tl,
+ industrialMentorEn .tl_set:N = \l_@@_value_industrial_mentor_en_tl,
degree .tl_set:N = \l_@@_value_degree_tl,
degreeEn .tl_set:N = \l_@@_value_degree_en_tl,
institute .tl_set:N = \l_@@_value_institute_tl,
@@ -686,10 +705,13 @@
defenseDateEn .initial:n = {June,~2019~(example)},
% 因为默认不显示,所以不需要设置初始值。
classifiedLevel .tl_set:N = \l_@@_value_classified_level_tl,
- % 特别类型-交叉研究方向
+ % 学生类型-工程硕博士专项
+ 工程硕博士专项 .bool_set:N = \l_@@_value_engineering_special_plan_bool,
+ 工程硕博士专项 .initial:n = {false},
+ % 学生类型-交叉研究方向
crossResearch .bool_set:N = \l_@@_value_cross_research_bool,
crossResearch .initial:n = {false},
- % 特别类型-政府项目留学生
+ % 学生类型-政府项目留学生
internationalStudentUGP .bool_set:N = \l_@@_value_international_student_ugp_bool,
internationalStudentUGP .initial:n = {false},
}
@@ -791,17 +813,9 @@
\keys_define:nn { bithesis / const / info }
{
degree .tl_set:N = \g_@@_const_info_degree_tl,
- degree .initial:n = {
- \c_@@_graduate_label_degree_tl
- },
+ degree .initial:n = {\c_@@_auto_tl},
major .tl_set:N = \g_@@_const_info_major_tl,
- major .initial:n = {
- \@@_if_graduate:TF {
- \c_@@_graduate_label_major_tl
- } {
- \@@_get_const:N {major}
- }
- },
+ major .initial:n = {\c_@@_auto_tl},
}
\keys_define:nn { bithesis / const / heading }
{
@@ -927,8 +941,34 @@
}
% \end{macrocode}
%
-% \subsubsection{处理模板选项}
+% \subsubsection{l3keys 键值对预处理}
%
+% 计算 auto 并替换为标准的值
+% \begin{macrocode}
+\cs_new:Npn \@@_resolve_auto_values: {
+ \tl_if_eq:NnT \g_@@_const_info_degree_tl {\c_@@_auto_tl} {
+ \tl_if_eq:NnTF \l_@@_value_degree_type_tl {academic} {
+ \keys_set:nn {bithesis} {const/info/degree = \c_@@_graduate_label_degree_tl}
+ } {
+ \keys_set:nn {bithesis} {const/info/degree = 申\quad 请\quad 类\quad 别}
+ }
+ }
+ \tl_if_eq:NnT \g_@@_const_info_major_tl {\c_@@_auto_tl} {
+ \@@_if_graduate:TF {
+ \tl_if_eq:NnTF \l_@@_value_degree_type_tl {academic} {
+ \keys_set:nn {bithesis} {const/info/major = \c_@@_graduate_label_major_tl}
+ } {
+ \keys_set:nn {bithesis} {const/info/major = 学\quad 位\quad 领\quad 域}
+ }
+ } {
+ \keys_set:nn {bithesis} {const/info/major = \@@_get_const:N {major}}
+ }
+ }
+}
+% \end{macrocode}
+%
+% \subsubsection{应用模板选项}
+%
% 英文模板需要开启 ctexbook 宏包的英文选项。
% \begin{macrocode}
\@@_if_thesis_english:T {
@@ -1386,8 +1426,8 @@
titleformat = {},
aftername = \hspace{9bp},
pagestyle = BIThesis,
- beforeskip = 8bp,
- afterskip = 32bp,
+ beforeskip = \@@_if_graduate:TF {13bp} {8bp},
+ afterskip = \@@_if_graduate:TF {24.5bp} {32bp},
fixskip = true,
lofskip = 0cm,
lotskip = 0cm,
@@ -1400,8 +1440,8 @@
nameformat = {},
titleformat = {},
aftername = \hspace{8bp},
- beforeskip = 20bp,
- afterskip = 17bp,
+ beforeskip = \@@_if_graduate:TF {26bp} {20bp},
+ afterskip = \@@_if_graduate:TF {18bp} {17bp},
fixskip = true,
}
}
@@ -1573,7 +1613,7 @@
format = {
\l_@@_title_font_cs:n \l_@@_unnumchapter_style_cs:n \centering \zihao{3}
},
- afterskip = 26bp,
+ afterskip = \@@_if_graduate:TF {31bp} {26bp},
}
}
}
@@ -1921,8 +1961,8 @@
%
% 参数如下:
% \begin{itemize}
-% \item \#1: |dim| 用于存储最大宽度。
-% \item \#2: |seq| 用于存储文本。
+% \item \#1: |dim| 用于输出最大宽度。
+% \item \#2: |seq| 用于输入文本。
% \end{itemize}
% \begin{macrocode}
\cs_new:Npn \@@_get_max_text_width:NN #1#2
@@ -1935,8 +1975,7 @@
{
\seq_pop_left:NN \l_@@_tmpa_seq \l_@@_tmpa_tl
\@@_get_text_width:NV \l_@@_tmpa_dim \l_@@_tmpa_tl
- % 在两边加上空白,避免文本太靠边。
- \dim_gset:Nn #1 { \dim_max:nn {#1} { \l_@@_tmpa_dim + \l_@@_cover_auto_width_padding_dim * 2} }
+ \dim_gset:Nn #1 { \dim_max:nn {#1} { \l_@@_tmpa_dim } }
}
\group_end:
}
@@ -1993,6 +2032,8 @@
\bool_if:NT \l_@@_cover_auto_width_bool {
\@@_get_max_text_width:NN \l_@@_cover_label_max_width_dim \l_@@_left_seq
\@@_get_max_text_width:NN \l_@@_cover_value_max_width_dim \l_@@_right_seq
+ % 在 value 两边加上空白,避免文本太靠边。
+ \dim_add:Nn \l_@@_cover_value_max_width_dim { \l_@@_cover_auto_width_padding_dim * 2 }
}
@@ -2030,8 +2071,17 @@
\vspace*{65mm}
{\heiti\zihao{-2} \l_@@_value_title_tl}
\vskip 60mm
- % 黑体 小三
- {\heiti \zihao{-3} \@@_secret_info:nn{\l_@@_value_author_tl}{\g_@@_const_substitute_symbol_tl~\g_@@_const_substitute_symbol_tl~\g_@@_const_substitute_symbol_tl}}
+ {
+ % 渲染信息。
+ \clist_set:Nn \l_@@_input_clist {
+ {姓名:} {\@@_secret_info:nn{\l_@@_value_author_tl}{\g_@@_const_substitute_symbol_tl\g_@@_const_substitute_symbol_tl\g_@@_const_substitute_symbol_tl}},
+ {学号:} {\@@_secret_info:N \l_@@_value_student_id_tl},
+ {学院:} {\l_@@_value_school_tl},
+ }
+ \linespread{2.0}\selectfont
+ % 黑体 小三
+ \heiti \zihao{-3} \@@_render_cover_entry:n \l_@@_input_clist
+ }
\vskip 10mm
% 黑体 小三
{\heiti \zihao{-3} \l_@@_cover_date_tl}
@@ -2043,6 +2093,12 @@
% \begin{macro}{\make_paper_back:}
% 制作书脊。
% \begin{macrocode}
+% TODO: 使用统一方式警告
+\msg_new:nnn { bithesis } { paper-back/missing-degree-type-icon-file }
+ {
+ Failed~to~find~the~file~for~degree~type~in~the~paper~back:~#1.\\
+ Please~download~from~https://github.com/BITNP/BIThesis/blob/main/templates/graduate-thesis/ #1.
+ }
\cs_new:Npn \make_paper_back: {
\cleardoublepage
\currentpdfbookmark{书脊}{frontmatter:paperback}
@@ -2052,6 +2108,17 @@
\linespread{1.1}\selectfont
\begin{minipage}[c][19.7cm]{2em}
\centering
+ {
+ \tl_new:N \l_@@_icon_path_tl
+ \tl_set:Nx \l_@@_icon_path_tl { misc/icon_ \l_@@_value_degree_type_tl .jpg }
+ \file_if_exist:nTF {\l_@@_icon_path_tl} {
+ \includegraphics[width=1.5em]{\l_@@_icon_path_tl}
+ } {
+ \msg_warning:nnV {bithesis} {paper-back/missing-degree-type-icon-file} {\l_@@_icon_path_tl}
+ }
+ }
+ \vspace{1em plus 1fill}
+ \par
{
\heiti\zihao{3}
\tl_if_blank:VTF \l_@@_value_vertical_title_tl
@@ -2085,9 +2152,9 @@
\hfill
- % 以下内容是「特别类型」的内容,
+ % 以下内容是「学生类型」的内容,
% 在没有勾选的时候隐藏。
- \bool_if:nT {\l_@@_cover_show_special_type_box_bool || \l_@@_value_international_student_ugp_bool || \l_@@_value_cross_research_bool} {
+ \bool_if:nT {\l_@@_cover_show_special_type_box_bool || \l_@@_value_international_student_ugp_bool || \l_@@_value_cross_research_bool || \l_@@_value_engineering_special_plan_bool} {
\begin{minipage}[t]{0.48\textwidth}
\vspace{-12pt}
\begin{flushright}
@@ -2099,6 +2166,12 @@
{
\zihao{4}
+ \bool_if:NTF \l_@@_value_engineering_special_plan_bool {\boxcheck:} {\boxempty:}
+ }
+ \hspace{1pt}\c_@@_label_engineering_special_plan_tl\\
+
+ {
+ \zihao{4}
\bool_if:NTF \l_@@_value_cross_research_bool {\boxcheck:} {\boxempty:}
}
\hspace{1pt}\c_@@_label_cross_research_tl\\
@@ -2151,6 +2224,7 @@
{\c_@@_graduate_label_author_tl} {\@@_secret_info:nn{\l_@@_value_author_tl}{\g_@@_const_substitute_symbol_tl\g_@@_const_substitute_symbol_tl\g_@@_const_substitute_symbol_tl}},
{\c_@@_graduate_label_school_tl} {\l_@@_value_school_tl},
{\c_@@_graduate_label_supervisor_tl} {\@@_secret_info:N{\l_@@_value_supervisor_tl}},
+ {\c_@@_graduate_label_industrial_mentor_tl} {\@@_secret_info:N{\l_@@_value_industrial_mentor_tl}},
{\c_@@_graduate_label_chairman_tl} {\@@_secret_info:N{\l_@@_value_chairman_tl}},
{\g_@@_const_info_degree_tl} {\l_@@_value_degree_tl},
{\g_@@_const_info_major_tl} {\l_@@_value_major_tl},
@@ -2209,6 +2283,7 @@
{\c_@@_graduate_label_author_en_tl} {\@@_secret_info:N{\l_@@_value_author_en_tl}},
{\c_@@_graduate_label_school_en_tl} {\l_@@_value_school_en_tl},
{\c_@@_graduate_label_supervisor_en_tl} {\@@_secret_info:N{\l_@@_value_supervisor_en_tl}},
+ {\c_@@_graduate_label_industrial_mentor_en_tl} {\@@_secret_info:N{\l_@@_value_industrial_mentor_en_tl}},
{\c_@@_graduate_label_chairman_en_tl} {\@@_secret_info:N{\l_@@_value_chairman_en_tl}},
{\c_@@_graduate_label_degree_en_tl} {\l_@@_value_degree_en_tl},
{\c_@@_graduate_label_major_en_tl} {\l_@@_value_major_en_tl},
@@ -2317,7 +2392,10 @@
% 提供用户配置的接口。
% \begin{macrocode}
\DeclareDocumentCommand \BITSetup { m }
- { \keys_set:nn { bithesis } { #1 }}
+ {
+ \keys_set:nn { bithesis } { #1 }
+ \@@_resolve_auto_values:
+ }
% \end{macrocode}
% \end{macro}
%
@@ -2852,6 +2930,7 @@
\cleardoublepage
\linespread{1.53}\selectfont
+ % 本科模板在标题「摘要」二字上方另有毕业设计题目
\@@_if_bachelor_thesis:T {
\begin{center}
\vspace*{-17bp}
@@ -2878,6 +2957,12 @@
}
}
+ % 微调硕博模板标题上下的间距
+ \@@_if_graduate:T { \ctexset{ chapter = {
+ beforeskip = 13bp,
+ afterskip = 24bp,
+ } } }
+
{
\@@_same_page:
\bool_if:NTF \l_@@_add_abstract_to_toc_bool {
@@ -2941,6 +3026,12 @@
}
}
+ % 微调硕博模板标题上下的间距
+ \@@_if_graduate:T { \ctexset{ chapter = {
+ beforeskip = 19bp,
+ afterskip = 35bp,
+ } } }
+
{
\@@_same_page:
\bool_if:nTF {\l_@@_add_abstract_en_to_toc_bool} {
@@ -3641,8 +3732,8 @@
%
% 参数如下:
% \begin{itemize}
-% \item \#1: |dim| 用于存储最大宽度。
-% \item \#2: |seq| 用于存储文本。
+% \item \#1: |dim| 用于输出最大宽度。
+% \item \#2: |seq| 用于输入存储文本。
% \end{itemize}
% \begin{macrocode}
\cs_new:Npn \@@_get_max_text_width:NN #1#2
@@ -3655,8 +3746,7 @@
{
\seq_pop_left:NN \l_@@_tmpa_seq \l_@@_tmpa_tl
\@@_get_text_width:NV \l_@@_tmpa_dim \l_@@_tmpa_tl
- % 在两边加上空白,避免文本太靠边。
- \dim_gset:Nn #1 { \dim_max:nn {#1} { \l_@@_tmpa_dim + \l_@@_cover_auto_width_padding_dim * 2} }
+ \dim_gset:Nn #1 { \dim_max:nn {#1} { \l_@@_tmpa_dim } }
}
\group_end:
}
@@ -3713,6 +3803,8 @@
\bool_if:NT \l_@@_cover_auto_width_bool {
\@@_get_max_text_width:NN \l_@@_cover_label_max_width_dim \l_@@_left_seq
\@@_get_max_text_width:NN \l_@@_cover_value_max_width_dim \l_@@_right_seq
+ % 在 value 两边加上空白,避免文本太靠边。
+ \dim_add:Nn \l_@@_cover_value_max_width_dim { \l_@@_cover_auto_width_padding_dim * 2 }
}
@@ -4135,7 +4227,8 @@
{LR}{简易实验报告模板(lab-report)}
{PT}{本科生毕业设计外文翻译模板(paper-translation)}
{PS}{北理工主题的 Beamer 模板(presentation-slide)}
- {UP}{本科生毕业设计开题报告(undergraduate-proposal)}
+ {UP}{本科生毕业设计开题报告(undergraduate-proposal,已废弃)}
+ {RR}{本科生读书报告模板(reading-report)}
}
}
@@ -4303,7 +4396,7 @@
}
\lstnewenvironment{latex}[1][]{\lstset{style=lstStyleLaTeX, #1}}{}
-\lstnewenvironment{shell}{\lstset{style=lstStyleShell}}{}
+\lstnewenvironment{shell}[1][]{\lstset{style=lstStyleShell, #1}}{}
\lstnewenvironment{bitsyntax}[1][]{\lstset{style=lstStyleSyntax, #1}}{}
\def\orbar{\textup{\textbar}}
Modified: trunk/Master/texmf-dist/source/latex/bithesis/bithesis.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/bithesis/bithesis.ins 2025-04-08 17:24:11 UTC (rev 74876)
+++ trunk/Master/texmf-dist/source/latex/bithesis/bithesis.ins 2025-04-08 20:11:20 UTC (rev 74877)
@@ -1,4 +1,4 @@
-%% Copyright (C) 2023
+%% Copyright (C) 2025
%% Association of Bit Network Pioneer and any individual authors listed elsewhere in this file.
%% --------------------------------------------------------------------------
%%
@@ -22,7 +22,7 @@
\preamble
- Copyright (C) 2023
+ Copyright (C) 2025
Association of Bit Network Pioneer and any individual authors listed in the documentation.
------------------------------------------------------------------------------
Modified: trunk/Master/texmf-dist/tex/latex/bithesis/bitbeamer.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/bithesis/bitbeamer.cls 2025-04-08 17:24:11 UTC (rev 74876)
+++ trunk/Master/texmf-dist/tex/latex/bithesis/bitbeamer.cls 2025-04-08 20:11:20 UTC (rev 74877)
@@ -6,7 +6,7 @@
%%
%% bithesis.dtx (with options: `cls,beamer')
%%
-%% Copyright (C) 2023
+%% Copyright (C) 2025
%% Association of Bit Network Pioneer and any individual authors listed in the documentation.
%% ------------------------------------------------------------------------------
%%
@@ -27,7 +27,7 @@
%%
\RequirePackage{expl3,l3keys2e}
\ProvidesExplClass{bitbeamer}
-{2025-03-25}{3.8.2}{BIT Thesis Templates}
+{2025-04-08}{3.8.3}{BIT Thesis Templates}
\keys_define:nn { bitbeamer }
{
titlegraphic .tl_set:N = \l_bit_titlegraphic_tl,
Modified: trunk/Master/texmf-dist/tex/latex/bithesis/bithesis.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/bithesis/bithesis.cls 2025-04-08 17:24:11 UTC (rev 74876)
+++ trunk/Master/texmf-dist/tex/latex/bithesis/bithesis.cls 2025-04-08 20:11:20 UTC (rev 74877)
@@ -6,7 +6,7 @@
%%
%% bithesis.dtx (with options: `cls,thesis')
%%
-%% Copyright (C) 2023
+%% Copyright (C) 2025
%% Association of Bit Network Pioneer and any individual authors listed in the documentation.
%% ------------------------------------------------------------------------------
%%
@@ -27,7 +27,7 @@
%%
\RequirePackage{expl3,l3keys2e}
\ProvidesExplClass{bithesis}
-{2025-03-25}{3.8.2}{BIT Thesis Templates}
+{2025-04-08}{3.8.3}{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
@@ -76,6 +76,7 @@
{#1}
{#2}
}
+\cs_new:Npn \__bithesis_if_graduate:T #1 {\__bithesis_if_graduate:TF {#1} {}}
\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} {}}
@@ -149,7 +150,8 @@
{classification} {中图分类号:},
{classified_level} {密级},
{type} {种类},
- {special_type} {特别类型},
+ {special_type} {学生类型},
+ {engineering_special_plan} {工程硕博士专项},
{cross_research} {交叉研究方向},
{international_student_ugp} {政府项目留学生},
}
@@ -233,14 +235,16 @@
} {\__bithesis_define_label_by_thesis_type:nnn {graduate} #1}
\clist_map_inline:nn
{
+ % TODO: 自动实现汉字均排
{author} {作\quad 者\quad 姓\quad 名} {Candidate~Name},
{school} {学\quad 院\quad 名\quad 称} {School~or~Department},
{supervisor} {指\quad 导\quad 教\quad 师} {Faculty~Mentor},
+ {industrial_mentor} {行\smallgap: 业\smallgap: 合\smallgap: 作\smallgap: 导\smallgap: 师} {Industry~Collaboration~Mentor},
{chairman} {答辩委员会主席} {Chair,~Thesis~Committee},
- {degree}
- {申\quad 请\quad 学\quad 位}
- {Degree~Applied},
- {major} {学\quad 科\hspace{0.8ex} / \hspace{0.8ex} 类\quad 别} {Major},
+ % degree、major 的中文与 degreeType 有关,此处以 academic 为准,其余情况通过 \c__bithesis_auto_tl 处理
+ % 英文倒是无关。
+ {degree} {申\quad 请\quad 学\quad 位} {Degree~Applied},
+ {major} {一\quad 级\quad 学\quad 科} {Major},
{institute}
{学\smallgap: 位\smallgap: 授\smallgap: 予\smallgap: 单\smallgap: 位}
{Degree~by},
@@ -308,6 +312,7 @@
本科生毕业设计(论文)外文翻译,
Beijing\nobreak{~}Institute\nobreak{~}of\nobreak{~}Technology~Bachelor's~Thesis,
}
+\tl_const:Nn \c__bithesis_auto_tl { BIThesis-auto-magic }
\keys_define:nn { bithesis }
{
info .meta:nn = { bithesis / info } {#1},
@@ -418,7 +423,15 @@
% UDC 分类号,研究生学位论文使用
UDC .tl_set:N = \l__bithesis_value_udc_tl,
UDC .initial:n = {540(示例)},
+ % 学术型/专业型,研究生学位论文使用
+ degreeType .choice:,
+ degreeType .choices:nn = {professional, academic} {
+ \tl_set:Nn \l__bithesis_value_degree_type_tl {#1}
+ },
+ degreeType .initial:n = academic,
chairman .tl_set:N = \l__bithesis_value_chairman_tl,
+ industrialMentor .tl_set:N = \l__bithesis_value_industrial_mentor_tl,
+ industrialMentorEn .tl_set:N = \l__bithesis_value_industrial_mentor_en_tl,
degree .tl_set:N = \l__bithesis_value_degree_tl,
degreeEn .tl_set:N = \l__bithesis_value_degree_en_tl,
institute .tl_set:N = \l__bithesis_value_institute_tl,
@@ -435,10 +448,13 @@
defenseDateEn .initial:n = {June,~2019~(example)},
% 因为默认不显示,所以不需要设置初始值。
classifiedLevel .tl_set:N = \l__bithesis_value_classified_level_tl,
- % 特别类型-交叉研究方向
+ % 学生类型-工程硕博士专项
+ 工程硕博士专项 .bool_set:N = \l__bithesis_value_engineering_special_plan_bool,
+ 工程硕博士专项 .initial:n = {false},
+ % 学生类型-交叉研究方向
crossResearch .bool_set:N = \l__bithesis_value_cross_research_bool,
crossResearch .initial:n = {false},
- % 特别类型-政府项目留学生
+ % 学生类型-政府项目留学生
internationalStudentUGP .bool_set:N = \l__bithesis_value_international_student_ugp_bool,
internationalStudentUGP .initial:n = {false},
}
@@ -532,17 +548,9 @@
\keys_define:nn { bithesis / const / info }
{
degree .tl_set:N = \g__bithesis_const_info_degree_tl,
- degree .initial:n = {
- \c__bithesis_graduate_label_degree_tl
- },
+ degree .initial:n = {\c__bithesis_auto_tl},
major .tl_set:N = \g__bithesis_const_info_major_tl,
- major .initial:n = {
- \__bithesis_if_graduate:TF {
- \c__bithesis_graduate_label_major_tl
- } {
- \__bithesis_get_const:N {major}
- }
- },
+ major .initial:n = {\c__bithesis_auto_tl},
}
\keys_define:nn { bithesis / const / heading }
{
@@ -643,6 +651,26 @@
} {
\keys_set:nn {bithesis} {cover/hideCoverInPeerReview = true}
}
+\cs_new:Npn \__bithesis_resolve_auto_values: {
+ \tl_if_eq:NnT \g__bithesis_const_info_degree_tl {\c__bithesis_auto_tl} {
+ \tl_if_eq:NnTF \l__bithesis_value_degree_type_tl {academic} {
+ \keys_set:nn {bithesis} {const/info/degree = \c__bithesis_graduate_label_degree_tl}
+ } {
+ \keys_set:nn {bithesis} {const/info/degree = 申\quad 请\quad 类\quad 别}
+ }
+ }
+ \tl_if_eq:NnT \g__bithesis_const_info_major_tl {\c__bithesis_auto_tl} {
+ \__bithesis_if_graduate:TF {
+ \tl_if_eq:NnTF \l__bithesis_value_degree_type_tl {academic} {
+ \keys_set:nn {bithesis} {const/info/major = \c__bithesis_graduate_label_major_tl}
+ } {
+ \keys_set:nn {bithesis} {const/info/major = 学\quad 位\quad 领\quad 域}
+ }
+ } {
+ \keys_set:nn {bithesis} {const/info/major = \__bithesis_get_const:N {major}}
+ }
+ }
+}
\__bithesis_if_thesis_english:T {
\PassOptionsToClass{scheme=plain}{ctexbook}
}
@@ -964,8 +992,8 @@
titleformat = {},
aftername = \hspace{9bp},
pagestyle = BIThesis,
- beforeskip = 8bp,
- afterskip = 32bp,
+ beforeskip = \__bithesis_if_graduate:TF {13bp} {8bp},
+ afterskip = \__bithesis_if_graduate:TF {24.5bp} {32bp},
fixskip = true,
lofskip = 0cm,
lotskip = 0cm,
@@ -978,8 +1006,8 @@
nameformat = {},
titleformat = {},
aftername = \hspace{8bp},
- beforeskip = 20bp,
- afterskip = 17bp,
+ beforeskip = \__bithesis_if_graduate:TF {26bp} {20bp},
+ afterskip = \__bithesis_if_graduate:TF {18bp} {17bp},
fixskip = true,
}
}
@@ -1126,7 +1154,7 @@
format = {
\l__bithesis_title_font_cs:n \l__bithesis_unnumchapter_style_cs:n \centering \zihao{3}
},
- afterskip = 26bp,
+ afterskip = \__bithesis_if_graduate:TF {31bp} {26bp},
}
}
}
@@ -1354,8 +1382,7 @@
{
\seq_pop_left:NN \l__bithesis_tmpa_seq \l__bithesis_tmpa_tl
\__bithesis_get_text_width:NV \l__bithesis_tmpa_dim \l__bithesis_tmpa_tl
- % 在两边加上空白,避免文本太靠边。
- \dim_gset:Nn #1 { \dim_max:nn {#1} { \l__bithesis_tmpa_dim + \l__bithesis_cover_auto_width_padding_dim * 2} }
+ \dim_gset:Nn #1 { \dim_max:nn {#1} { \l__bithesis_tmpa_dim } }
}
\group_end:
}
@@ -1392,6 +1419,8 @@
\bool_if:NT \l__bithesis_cover_auto_width_bool {
\__bithesis_get_max_text_width:NN \l__bithesis_cover_label_max_width_dim \l__bithesis_left_seq
\__bithesis_get_max_text_width:NN \l__bithesis_cover_value_max_width_dim \l__bithesis_right_seq
+ % 在 value 两边加上空白,避免文本太靠边。
+ \dim_add:Nn \l__bithesis_cover_value_max_width_dim { \l__bithesis_cover_auto_width_padding_dim * 2 }
}
% 最后,根据宽度渲染 label 和 value 对。
@@ -1422,13 +1451,27 @@
\vspace*{65mm}
{\heiti\zihao{-2} \l__bithesis_value_title_tl}
\vskip 60mm
- % 黑体 小三
- {\heiti \zihao{-3} \__bithesis_secret_info:nn{\l__bithesis_value_author_tl}{\g__bithesis_const_substitute_symbol_tl~\g__bithesis_const_substitute_symbol_tl~\g__bithesis_const_substitute_symbol_tl}}
+ {
+ % 渲染信息。
+ \clist_set:Nn \l__bithesis_input_clist {
+ {姓名:} {\__bithesis_secret_info:nn{\l__bithesis_value_author_tl}{\g__bithesis_const_substitute_symbol_tl\g__bithesis_const_substitute_symbol_tl\g__bithesis_const_substitute_symbol_tl}},
+ {学号:} {\__bithesis_secret_info:N \l__bithesis_value_student_id_tl},
+ {学院:} {\l__bithesis_value_school_tl},
+ }
+ \linespread{2.0}\selectfont
+ % 黑体 小三
+ \heiti \zihao{-3} \__bithesis_render_cover_entry:n \l__bithesis_input_clist
+ }
\vskip 10mm
% 黑体 小三
{\heiti \zihao{-3} \l__bithesis_cover_date_tl}
\end{titlepage}
}
+\msg_new:nnn { bithesis } { paper-back/missing-degree-type-icon-file }
+ {
+ Failed~to~find~the~file~for~degree~type~in~the~paper~back:~#1.\\
+ Please~download~from~https://github.com/BITNP/BIThesis/blob/main/templates/graduate-thesis/ #1.
+ }
\cs_new:Npn \make_paper_back: {
\cleardoublepage
\currentpdfbookmark{书脊}{frontmatter:paperback}
@@ -1439,6 +1482,17 @@
\begin{minipage}[c][19.7cm]{2em}
\centering
{
+ \tl_new:N \l__bithesis_icon_path_tl
+ \tl_set:Nx \l__bithesis_icon_path_tl { misc/icon_ \l__bithesis_value_degree_type_tl .jpg }
+ \file_if_exist:nTF {\l__bithesis_icon_path_tl} {
+ \includegraphics[width=1.5em]{\l__bithesis_icon_path_tl}
+ } {
+ \msg_warning:nnV {bithesis} {paper-back/missing-degree-type-icon-file} {\l__bithesis_icon_path_tl}
+ }
+ }
+ \vspace{1em plus 1fill}
+ \par
+ {
\heiti\zihao{3}
\tl_if_blank:VTF \l__bithesis_value_vertical_title_tl
{\l__bithesis_value_title_tl}{\l__bithesis_value_vertical_title_tl}
@@ -1465,9 +1519,9 @@
\hfill
- % 以下内容是「特别类型」的内容,
+ % 以下内容是「学生类型」的内容,
% 在没有勾选的时候隐藏。
- \bool_if:nT {\l__bithesis_cover_show_special_type_box_bool || \l__bithesis_value_international_student_ugp_bool || \l__bithesis_value_cross_research_bool} {
+ \bool_if:nT {\l__bithesis_cover_show_special_type_box_bool || \l__bithesis_value_international_student_ugp_bool || \l__bithesis_value_cross_research_bool || \l__bithesis_value_engineering_special_plan_bool} {
\begin{minipage}[t]{0.48\textwidth}
\vspace{-12pt}
\begin{flushright}
@@ -1479,6 +1533,12 @@
{
\zihao{4}
+ \bool_if:NTF \l__bithesis_value_engineering_special_plan_bool {\boxcheck:} {\boxempty:}
+ }
+ \hspace{1pt}\c__bithesis_label_engineering_special_plan_tl\\
+
+ {
+ \zihao{4}
\bool_if:NTF \l__bithesis_value_cross_research_bool {\boxcheck:} {\boxempty:}
}
\hspace{1pt}\c__bithesis_label_cross_research_tl\\
@@ -1531,6 +1591,7 @@
{\c__bithesis_graduate_label_author_tl} {\__bithesis_secret_info:nn{\l__bithesis_value_author_tl}{\g__bithesis_const_substitute_symbol_tl\g__bithesis_const_substitute_symbol_tl\g__bithesis_const_substitute_symbol_tl}},
{\c__bithesis_graduate_label_school_tl} {\l__bithesis_value_school_tl},
{\c__bithesis_graduate_label_supervisor_tl} {\__bithesis_secret_info:N{\l__bithesis_value_supervisor_tl}},
+ {\c__bithesis_graduate_label_industrial_mentor_tl} {\__bithesis_secret_info:N{\l__bithesis_value_industrial_mentor_tl}},
{\c__bithesis_graduate_label_chairman_tl} {\__bithesis_secret_info:N{\l__bithesis_value_chairman_tl}},
{\g__bithesis_const_info_degree_tl} {\l__bithesis_value_degree_tl},
{\g__bithesis_const_info_major_tl} {\l__bithesis_value_major_tl},
@@ -1583,6 +1644,7 @@
{\c__bithesis_graduate_label_author_en_tl} {\__bithesis_secret_info:N{\l__bithesis_value_author_en_tl}},
{\c__bithesis_graduate_label_school_en_tl} {\l__bithesis_value_school_en_tl},
{\c__bithesis_graduate_label_supervisor_en_tl} {\__bithesis_secret_info:N{\l__bithesis_value_supervisor_en_tl}},
+ {\c__bithesis_graduate_label_industrial_mentor_en_tl} {\__bithesis_secret_info:N{\l__bithesis_value_industrial_mentor_en_tl}},
{\c__bithesis_graduate_label_chairman_en_tl} {\__bithesis_secret_info:N{\l__bithesis_value_chairman_en_tl}},
{\c__bithesis_graduate_label_degree_en_tl} {\l__bithesis_value_degree_en_tl},
{\c__bithesis_graduate_label_major_en_tl} {\l__bithesis_value_major_en_tl},
@@ -1671,7 +1733,10 @@
\cleardoublepage
}
\DeclareDocumentCommand \BITSetup { m }
- { \keys_set:nn { bithesis } { #1 }}
+ {
+ \keys_set:nn { bithesis } { #1 }
+ \__bithesis_resolve_auto_values:
+ }
\DeclareDocumentCommand \BigStar { }
{ \ding{72} }
\NewDocumentEnvironment {blindPeerReview} {O{\c_true_bool} +b}
@@ -2136,6 +2201,7 @@
\cleardoublepage
\linespread{1.53}\selectfont
+ % 本科模板在标题「摘要」二字上方另有毕业设计题目
\__bithesis_if_bachelor_thesis:T {
\begin{center}
\vspace*{-17bp}
@@ -2162,6 +2228,12 @@
}
}
+ % 微调硕博模板标题上下的间距
+ \__bithesis_if_graduate:T { \ctexset{ chapter = {
+ beforeskip = 13bp,
+ afterskip = 24bp,
+ } } }
+
{
\__bithesis_same_page:
\bool_if:NTF \l__bithesis_add_abstract_to_toc_bool {
@@ -2219,6 +2291,12 @@
}
}
+ % 微调硕博模板标题上下的间距
+ \__bithesis_if_graduate:T { \ctexset{ chapter = {
+ beforeskip = 19bp,
+ afterskip = 35bp,
+ } } }
+
{
\__bithesis_same_page:
\bool_if:nTF {\l__bithesis_add_abstract_en_to_toc_bool} {
Modified: trunk/Master/texmf-dist/tex/latex/bithesis/bitreport.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/bithesis/bitreport.cls 2025-04-08 17:24:11 UTC (rev 74876)
+++ trunk/Master/texmf-dist/tex/latex/bithesis/bitreport.cls 2025-04-08 20:11:20 UTC (rev 74877)
@@ -6,7 +6,7 @@
%%
%% bithesis.dtx (with options: `cls,report')
%%
-%% Copyright (C) 2023
+%% Copyright (C) 2025
%% Association of Bit Network Pioneer and any individual authors listed in the documentation.
%% ------------------------------------------------------------------------------
%%
@@ -27,7 +27,7 @@
%%
\RequirePackage{expl3,l3keys2e}
\ProvidesExplClass{bitreport}
-{2025-03-25}{3.8.2}{BIT Thesis Templates}
+{2025-04-08}{3.8.3}{BIT Thesis Templates}
\int_new:N \g__bithesis_report_type_int
\clist_const:Nn \c__bithesis_report_type_clist
{ common, undergraduate_proposal}
@@ -130,8 +130,7 @@
{
\seq_pop_left:NN \l__bithesis_tmpa_seq \l__bithesis_tmpa_tl
\__bithesis_get_text_width:NV \l__bithesis_tmpa_dim \l__bithesis_tmpa_tl
- % 在两边加上空白,避免文本太靠边。
- \dim_gset:Nn #1 { \dim_max:nn {#1} { \l__bithesis_tmpa_dim + \l__bithesis_cover_auto_width_padding_dim * 2} }
+ \dim_gset:Nn #1 { \dim_max:nn {#1} { \l__bithesis_tmpa_dim } }
}
\group_end:
}
@@ -168,6 +167,8 @@
\bool_if:NT \l__bithesis_cover_auto_width_bool {
\__bithesis_get_max_text_width:NN \l__bithesis_cover_label_max_width_dim \l__bithesis_left_seq
\__bithesis_get_max_text_width:NN \l__bithesis_cover_value_max_width_dim \l__bithesis_right_seq
+ % 在 value 两边加上空白,避免文本太靠边。
+ \dim_add:Nn \l__bithesis_cover_value_max_width_dim { \l__bithesis_cover_auto_width_padding_dim * 2 }
}
% 最后,根据宽度渲染 label 和 value 对。
More information about the tex-live-commits
mailing list.