Skip to content

Commit

Permalink
Merge pull request #364 from BITNP/357-bug-关于研究生学位论文封面的字段问题
Browse files Browse the repository at this point in the history
feat: support customize cover label.
  • Loading branch information
fky2015 committed Jun 17, 2023
2 parents aa8c4db + 4b7b6a1 commit b821cb5
Show file tree
Hide file tree
Showing 7 changed files with 304 additions and 170 deletions.
11 changes: 11 additions & 0 deletions bithesis-doc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,17 @@ \subsubsection{常量名称覆盖}
盲审模式下用于替换个人信息的替换符号。
\end{variable}

\begin{variable}[added=2023-06-11]{const/info/degree,const/info/major}
\begin{bitsyntax}[emph={[1]degree,major}]
info = {
degree = (*(申请学位级别)|\marg{字符串}*),
major = (*(学科专业)|\marg{字符串}*),
},
\end{bitsyntax}

用于定义封面中个人信息条目的各个常量值。
\end{variable}

\section{正文编写}

请注意,请在\env{document} 之内使用以下命令 。
Expand Down
91 changes: 57 additions & 34 deletions bithesis.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -673,38 +673,61 @@
% \begin{macrocode}
\keys_define:nn { bithesis / const }
{
autoref / algo .tl_set:N = \g_@@_const_autoref_algo_tl,
autoref / algo .initial:n = {\@@_get_const:N {algo}},
autoref / them .tl_set:N = \g_@@_const_autoref_them_tl,
autoref / them .initial:n = {\@@_get_const:N {them}},
autoref / lem .tl_set:N = \g_@@_const_autoref_lem_tl,
autoref / lem .initial:n = {\@@_get_const:N {lem}},
autoref / prop .tl_set:N = \g_@@_const_autoref_prop_tl,
autoref / prop .initial:n = {\@@_get_const:N {prop}},
autoref / cor .tl_set:N = \g_@@_const_autoref_cor_tl,
autoref / cor .initial:n = {\@@_get_const:N {cor}},
autoref / axi .tl_set:N = \g_@@_const_autoref_axi_tl,
autoref / axi .initial:n = {\@@_get_const:N {axi}},
autoref / defn .tl_set:N = \g_@@_const_autoref_defn_tl,
autoref / defn .initial:n = {\@@_get_const:N {defn}},
autoref / conj .tl_set:N = \g_@@_const_autoref_conj_tl,
autoref / conj .initial:n = {\@@_get_const:N {conj}},
autoref / exmp .tl_set:N = \g_@@_const_autoref_exmp_tl,
autoref / exmp .initial:n = {\@@_get_const:N {exmp}},
autoref / case .tl_set:N = \g_@@_const_autoref_case_tl,
autoref / case .initial:n = {\@@_get_const:N {case}},
autoref / rem .tl_set:N = \g_@@_const_autoref_rem_tl,
autoref / rem .initial:n = {\@@_get_const:N {rem}},
autoref / figure .tl_set:N = \g_@@_const_autoref_fig_tl,
autoref / figure .initial:n = {\@@_get_const:N {fig}},
autoref / table .tl_set:N = \g_@@_const_autoref_tab_tl,
autoref / table .initial:n = {\@@_get_const:N {tab}},
autoref / equ .tl_set:N = \g_@@_const_autoref_equ_tl,
autoref / equ .initial:n = {\@@_get_const:N {equ}},
style / substituteSymbol .tl_set:N = \g_@@_const_substitute_symbol_tl,
style / substituteSymbol .initial:n = {*},
autoref .meta:nn = { bithesis / const / autoref } { #1 },
style .meta:nn = { bithesis / const / style } { #1 },
info .meta:nn = { bithesis / const / info } { #1 },
}
\keys_define:nn { bithesis / const / autoref }
{
algo .tl_set:N = \g_@@_const_autoref_algo_tl,
algo .initial:n = {\@@_get_const:N {algo}},
them .tl_set:N = \g_@@_const_autoref_them_tl,
them .initial:n = {\@@_get_const:N {them}},
lem .tl_set:N = \g_@@_const_autoref_lem_tl,
lem .initial:n = {\@@_get_const:N {lem}},
prop .tl_set:N = \g_@@_const_autoref_prop_tl,
prop .initial:n = {\@@_get_const:N {prop}},
cor .tl_set:N = \g_@@_const_autoref_cor_tl,
cor .initial:n = {\@@_get_const:N {cor}},
axi .tl_set:N = \g_@@_const_autoref_axi_tl,
axi .initial:n = {\@@_get_const:N {axi}},
defn .tl_set:N = \g_@@_const_autoref_defn_tl,
defn .initial:n = {\@@_get_const:N {defn}},
conj .tl_set:N = \g_@@_const_autoref_conj_tl,
conj .initial:n = {\@@_get_const:N {conj}},
exmp .tl_set:N = \g_@@_const_autoref_exmp_tl,
exmp .initial:n = {\@@_get_const:N {exmp}},
case .tl_set:N = \g_@@_const_autoref_case_tl,
case .initial:n = {\@@_get_const:N {case}},
rem .tl_set:N = \g_@@_const_autoref_rem_tl,
rem .initial:n = {\@@_get_const:N {rem}},
figure .tl_set:N = \g_@@_const_autoref_fig_tl,
figure .initial:n = {\@@_get_const:N {fig}},
table .tl_set:N = \g_@@_const_autoref_tab_tl,
table .initial:n = {\@@_get_const:N {tab}},
equ .tl_set:N = \g_@@_const_autoref_equ_tl,
equ .initial:n = {\@@_get_const:N {equ}},
}
\keys_define:nn { bithesis / const / style }
{
substituteSymbol .tl_set:N = \g_@@_const_substitute_symbol_tl,
substituteSymbol .initial:n = {*},
}
\keys_define:nn { bithesis / const / info }
{
degree .tl_set:N = \g_@@_const_info_degree_tl,
degree .initial:n = {
\c_@@_graduate_label_degree_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}
}
},
}

% \end{macrocode}
%
% 定义 |bithesis/style| 键值对类。
Expand Down Expand Up @@ -1806,8 +1829,8 @@
{\c_@@_graduate_label_school_tl} {\l_@@_value_school_tl},
{\c_@@_graduate_label_supervisor_tl} {\@@_secret_info:x{\l_@@_value_supervisor_tl}},
{\c_@@_graduate_label_chairman_tl} {\@@_secret_info:x{\l_@@_value_chairman_tl}},
{\c_@@_graduate_label_degree_tl} {\l_@@_value_degree_tl},
{\c_@@_graduate_label_major_tl} {\l_@@_value_major_tl},
{\g_@@_const_info_degree_tl} {\l_@@_value_degree_tl},
{\g_@@_const_info_major_tl} {\l_@@_value_major_tl},
{\c_@@_graduate_label_institute_tl} {\l_@@_value_institute_tl},
{\c_@@_graduate_label_defense_date_tl} {\l_@@_value_defense_date_tl},
}
Expand Down Expand Up @@ -2075,7 +2098,7 @@

\clist_set:Nn \l_@@_input_clist {
{\c_@@_label_school_tl} {\l_@@_value_school_tl},
{\c_@@_label_major_tl} {\l_@@_value_major_tl},
{\g_@@_const_info_major_tl} {\l_@@_value_major_tl},
{\c_@@_label_class_tl} {\@@_secret_info:N \l_@@_value_class_tl},
{\c_@@_label_author_tl} {\@@_secret_info:N \l_@@_value_author_tl},
{\c_@@_label_student_id_tl} {\@@_secret_info:N \l_@@_value_student_id_tl},
Expand Down
91 changes: 57 additions & 34 deletions templates/graduate-thesis/bithesis.cls
Original file line number Diff line number Diff line change
Expand Up @@ -425,38 +425,61 @@
}
\keys_define:nn { bithesis / const }
{
autoref / algo .tl_set:N = \g__bithesis_const_autoref_algo_tl,
autoref / algo .initial:n = {\__bithesis_get_const:N {algo}},
autoref / them .tl_set:N = \g__bithesis_const_autoref_them_tl,
autoref / them .initial:n = {\__bithesis_get_const:N {them}},
autoref / lem .tl_set:N = \g__bithesis_const_autoref_lem_tl,
autoref / lem .initial:n = {\__bithesis_get_const:N {lem}},
autoref / prop .tl_set:N = \g__bithesis_const_autoref_prop_tl,
autoref / prop .initial:n = {\__bithesis_get_const:N {prop}},
autoref / cor .tl_set:N = \g__bithesis_const_autoref_cor_tl,
autoref / cor .initial:n = {\__bithesis_get_const:N {cor}},
autoref / axi .tl_set:N = \g__bithesis_const_autoref_axi_tl,
autoref / axi .initial:n = {\__bithesis_get_const:N {axi}},
autoref / defn .tl_set:N = \g__bithesis_const_autoref_defn_tl,
autoref / defn .initial:n = {\__bithesis_get_const:N {defn}},
autoref / conj .tl_set:N = \g__bithesis_const_autoref_conj_tl,
autoref / conj .initial:n = {\__bithesis_get_const:N {conj}},
autoref / exmp .tl_set:N = \g__bithesis_const_autoref_exmp_tl,
autoref / exmp .initial:n = {\__bithesis_get_const:N {exmp}},
autoref / case .tl_set:N = \g__bithesis_const_autoref_case_tl,
autoref / case .initial:n = {\__bithesis_get_const:N {case}},
autoref / rem .tl_set:N = \g__bithesis_const_autoref_rem_tl,
autoref / rem .initial:n = {\__bithesis_get_const:N {rem}},
autoref / figure .tl_set:N = \g__bithesis_const_autoref_fig_tl,
autoref / figure .initial:n = {\__bithesis_get_const:N {fig}},
autoref / table .tl_set:N = \g__bithesis_const_autoref_tab_tl,
autoref / table .initial:n = {\__bithesis_get_const:N {tab}},
autoref / equ .tl_set:N = \g__bithesis_const_autoref_equ_tl,
autoref / equ .initial:n = {\__bithesis_get_const:N {equ}},
style / substituteSymbol .tl_set:N = \g__bithesis_const_substitute_symbol_tl,
style / substituteSymbol .initial:n = {*},
autoref .meta:nn = { bithesis / const / autoref } { #1 },
style .meta:nn = { bithesis / const / style } { #1 },
info .meta:nn = { bithesis / const / info } { #1 },
}
\keys_define:nn { bithesis / const / autoref }
{
algo .tl_set:N = \g__bithesis_const_autoref_algo_tl,
algo .initial:n = {\__bithesis_get_const:N {algo}},
them .tl_set:N = \g__bithesis_const_autoref_them_tl,
them .initial:n = {\__bithesis_get_const:N {them}},
lem .tl_set:N = \g__bithesis_const_autoref_lem_tl,
lem .initial:n = {\__bithesis_get_const:N {lem}},
prop .tl_set:N = \g__bithesis_const_autoref_prop_tl,
prop .initial:n = {\__bithesis_get_const:N {prop}},
cor .tl_set:N = \g__bithesis_const_autoref_cor_tl,
cor .initial:n = {\__bithesis_get_const:N {cor}},
axi .tl_set:N = \g__bithesis_const_autoref_axi_tl,
axi .initial:n = {\__bithesis_get_const:N {axi}},
defn .tl_set:N = \g__bithesis_const_autoref_defn_tl,
defn .initial:n = {\__bithesis_get_const:N {defn}},
conj .tl_set:N = \g__bithesis_const_autoref_conj_tl,
conj .initial:n = {\__bithesis_get_const:N {conj}},
exmp .tl_set:N = \g__bithesis_const_autoref_exmp_tl,
exmp .initial:n = {\__bithesis_get_const:N {exmp}},
case .tl_set:N = \g__bithesis_const_autoref_case_tl,
case .initial:n = {\__bithesis_get_const:N {case}},
rem .tl_set:N = \g__bithesis_const_autoref_rem_tl,
rem .initial:n = {\__bithesis_get_const:N {rem}},
figure .tl_set:N = \g__bithesis_const_autoref_fig_tl,
figure .initial:n = {\__bithesis_get_const:N {fig}},
table .tl_set:N = \g__bithesis_const_autoref_tab_tl,
table .initial:n = {\__bithesis_get_const:N {tab}},
equ .tl_set:N = \g__bithesis_const_autoref_equ_tl,
equ .initial:n = {\__bithesis_get_const:N {equ}},
}
\keys_define:nn { bithesis / const / style }
{
substituteSymbol .tl_set:N = \g__bithesis_const_substitute_symbol_tl,
substituteSymbol .initial:n = {*},
}
\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
},
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}
}
},
}

\keys_define:nn { bithesis / style }
{
head .tl_set:N = \l__bithesis_style_head_tl,
Expand Down Expand Up @@ -1248,8 +1271,8 @@
{\c__bithesis_graduate_label_school_tl} {\l__bithesis_value_school_tl},
{\c__bithesis_graduate_label_supervisor_tl} {\__bithesis_secret_info:x{\l__bithesis_value_supervisor_tl}},
{\c__bithesis_graduate_label_chairman_tl} {\__bithesis_secret_info:x{\l__bithesis_value_chairman_tl}},
{\c__bithesis_graduate_label_degree_tl} {\l__bithesis_value_degree_tl},
{\c__bithesis_graduate_label_major_tl} {\l__bithesis_value_major_tl},
{\g__bithesis_const_info_degree_tl} {\l__bithesis_value_degree_tl},
{\g__bithesis_const_info_major_tl} {\l__bithesis_value_major_tl},
{\c__bithesis_graduate_label_institute_tl} {\l__bithesis_value_institute_tl},
{\c__bithesis_graduate_label_defense_date_tl} {\l__bithesis_value_defense_date_tl},
}
Expand Down Expand Up @@ -1453,7 +1476,7 @@

\clist_set:Nn \l__bithesis_input_clist {
{\c__bithesis_label_school_tl} {\l__bithesis_value_school_tl},
{\c__bithesis_label_major_tl} {\l__bithesis_value_major_tl},
{\g__bithesis_const_info_major_tl} {\l__bithesis_value_major_tl},
{\c__bithesis_label_class_tl} {\__bithesis_secret_info:N \l__bithesis_value_class_tl},
{\c__bithesis_label_author_tl} {\__bithesis_secret_info:N \l__bithesis_value_author_tl},
{\c__bithesis_label_student_id_tl} {\__bithesis_secret_info:N \l__bithesis_value_student_id_tl},
Expand Down
8 changes: 8 additions & 0 deletions templates/graduate-thesis/main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@
},
% 采用章节标题级别的附录格式
appendices / chapterLevel = true,
const = {
% 由于现存的 Word 模板、旧有 LaTeX 模板与《北京理工大学研究生学位论文撰写规范》的规定不一致,
% 论文封面的某些字段内容需要用户根据自己的情况进行手动调整。
% 目前给出的默认值是按照 2018 年发布的《北京理工大学研究生学位论文撰写规范》中的要求进行设置的。
% 比如注释掉的这一行:将会修改封面中的「申请学位级别」为「申请学位」。
% info / degree = {申\quad{}请\quad{}学\quad{}位},
% info / major = {学\quad{}科\hspace{5pt}/\hspace{5pt}类\quad{}别}
}
}

% 大部分关于参考文献样式的修改,都可以通过此处的选项进行配置。
Expand Down
91 changes: 57 additions & 34 deletions templates/paper-translation/bithesis.cls
Original file line number Diff line number Diff line change
Expand Up @@ -425,38 +425,61 @@
}
\keys_define:nn { bithesis / const }
{
autoref / algo .tl_set:N = \g__bithesis_const_autoref_algo_tl,
autoref / algo .initial:n = {\__bithesis_get_const:N {algo}},
autoref / them .tl_set:N = \g__bithesis_const_autoref_them_tl,
autoref / them .initial:n = {\__bithesis_get_const:N {them}},
autoref / lem .tl_set:N = \g__bithesis_const_autoref_lem_tl,
autoref / lem .initial:n = {\__bithesis_get_const:N {lem}},
autoref / prop .tl_set:N = \g__bithesis_const_autoref_prop_tl,
autoref / prop .initial:n = {\__bithesis_get_const:N {prop}},
autoref / cor .tl_set:N = \g__bithesis_const_autoref_cor_tl,
autoref / cor .initial:n = {\__bithesis_get_const:N {cor}},
autoref / axi .tl_set:N = \g__bithesis_const_autoref_axi_tl,
autoref / axi .initial:n = {\__bithesis_get_const:N {axi}},
autoref / defn .tl_set:N = \g__bithesis_const_autoref_defn_tl,
autoref / defn .initial:n = {\__bithesis_get_const:N {defn}},
autoref / conj .tl_set:N = \g__bithesis_const_autoref_conj_tl,
autoref / conj .initial:n = {\__bithesis_get_const:N {conj}},
autoref / exmp .tl_set:N = \g__bithesis_const_autoref_exmp_tl,
autoref / exmp .initial:n = {\__bithesis_get_const:N {exmp}},
autoref / case .tl_set:N = \g__bithesis_const_autoref_case_tl,
autoref / case .initial:n = {\__bithesis_get_const:N {case}},
autoref / rem .tl_set:N = \g__bithesis_const_autoref_rem_tl,
autoref / rem .initial:n = {\__bithesis_get_const:N {rem}},
autoref / figure .tl_set:N = \g__bithesis_const_autoref_fig_tl,
autoref / figure .initial:n = {\__bithesis_get_const:N {fig}},
autoref / table .tl_set:N = \g__bithesis_const_autoref_tab_tl,
autoref / table .initial:n = {\__bithesis_get_const:N {tab}},
autoref / equ .tl_set:N = \g__bithesis_const_autoref_equ_tl,
autoref / equ .initial:n = {\__bithesis_get_const:N {equ}},
style / substituteSymbol .tl_set:N = \g__bithesis_const_substitute_symbol_tl,
style / substituteSymbol .initial:n = {*},
autoref .meta:nn = { bithesis / const / autoref } { #1 },
style .meta:nn = { bithesis / const / style } { #1 },
info .meta:nn = { bithesis / const / info } { #1 },
}
\keys_define:nn { bithesis / const / autoref }
{
algo .tl_set:N = \g__bithesis_const_autoref_algo_tl,
algo .initial:n = {\__bithesis_get_const:N {algo}},
them .tl_set:N = \g__bithesis_const_autoref_them_tl,
them .initial:n = {\__bithesis_get_const:N {them}},
lem .tl_set:N = \g__bithesis_const_autoref_lem_tl,
lem .initial:n = {\__bithesis_get_const:N {lem}},
prop .tl_set:N = \g__bithesis_const_autoref_prop_tl,
prop .initial:n = {\__bithesis_get_const:N {prop}},
cor .tl_set:N = \g__bithesis_const_autoref_cor_tl,
cor .initial:n = {\__bithesis_get_const:N {cor}},
axi .tl_set:N = \g__bithesis_const_autoref_axi_tl,
axi .initial:n = {\__bithesis_get_const:N {axi}},
defn .tl_set:N = \g__bithesis_const_autoref_defn_tl,
defn .initial:n = {\__bithesis_get_const:N {defn}},
conj .tl_set:N = \g__bithesis_const_autoref_conj_tl,
conj .initial:n = {\__bithesis_get_const:N {conj}},
exmp .tl_set:N = \g__bithesis_const_autoref_exmp_tl,
exmp .initial:n = {\__bithesis_get_const:N {exmp}},
case .tl_set:N = \g__bithesis_const_autoref_case_tl,
case .initial:n = {\__bithesis_get_const:N {case}},
rem .tl_set:N = \g__bithesis_const_autoref_rem_tl,
rem .initial:n = {\__bithesis_get_const:N {rem}},
figure .tl_set:N = \g__bithesis_const_autoref_fig_tl,
figure .initial:n = {\__bithesis_get_const:N {fig}},
table .tl_set:N = \g__bithesis_const_autoref_tab_tl,
table .initial:n = {\__bithesis_get_const:N {tab}},
equ .tl_set:N = \g__bithesis_const_autoref_equ_tl,
equ .initial:n = {\__bithesis_get_const:N {equ}},
}
\keys_define:nn { bithesis / const / style }
{
substituteSymbol .tl_set:N = \g__bithesis_const_substitute_symbol_tl,
substituteSymbol .initial:n = {*},
}
\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
},
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}
}
},
}

\keys_define:nn { bithesis / style }
{
head .tl_set:N = \l__bithesis_style_head_tl,
Expand Down Expand Up @@ -1248,8 +1271,8 @@
{\c__bithesis_graduate_label_school_tl} {\l__bithesis_value_school_tl},
{\c__bithesis_graduate_label_supervisor_tl} {\__bithesis_secret_info:x{\l__bithesis_value_supervisor_tl}},
{\c__bithesis_graduate_label_chairman_tl} {\__bithesis_secret_info:x{\l__bithesis_value_chairman_tl}},
{\c__bithesis_graduate_label_degree_tl} {\l__bithesis_value_degree_tl},
{\c__bithesis_graduate_label_major_tl} {\l__bithesis_value_major_tl},
{\g__bithesis_const_info_degree_tl} {\l__bithesis_value_degree_tl},
{\g__bithesis_const_info_major_tl} {\l__bithesis_value_major_tl},
{\c__bithesis_graduate_label_institute_tl} {\l__bithesis_value_institute_tl},
{\c__bithesis_graduate_label_defense_date_tl} {\l__bithesis_value_defense_date_tl},
}
Expand Down Expand Up @@ -1453,7 +1476,7 @@

\clist_set:Nn \l__bithesis_input_clist {
{\c__bithesis_label_school_tl} {\l__bithesis_value_school_tl},
{\c__bithesis_label_major_tl} {\l__bithesis_value_major_tl},
{\g__bithesis_const_info_major_tl} {\l__bithesis_value_major_tl},
{\c__bithesis_label_class_tl} {\__bithesis_secret_info:N \l__bithesis_value_class_tl},
{\c__bithesis_label_author_tl} {\__bithesis_secret_info:N \l__bithesis_value_author_tl},
{\c__bithesis_label_student_id_tl} {\__bithesis_secret_info:N \l__bithesis_value_student_id_tl},
Expand Down
Loading

0 comments on commit b821cb5

Please sign in to comment.