Skip to content

Commit

Permalink
Merge pull request #155 from BITNP/latex3
Browse files Browse the repository at this point in the history
Refactor and bug fixes.
  • Loading branch information
fky2015 authored Aug 6, 2022
2 parents 884a052 + 2cff7d1 commit 4d4fb55
Show file tree
Hide file tree
Showing 13 changed files with 580 additions and 346 deletions.
397 changes: 311 additions & 86 deletions bithesis.dtx

Large diffs are not rendered by default.

115 changes: 54 additions & 61 deletions templates/graduate-thesis/bithesis.cls
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
\RequirePackage{expl3,l3keys2e}
\ProvidesExplClass{bithesis}
{2022-06-10}{3.0.0}{BIT Thesis Templates}
%%%% TODO:


\int_new:N \g__bithesis_thesis_type_int
Expand All @@ -42,8 +41,8 @@
\seq_new:N \l__bithesis_left_seq


\cs_generate_variant:Nn \tl_if_empty:nTF {e}
\cs_generate_variant:Nn \seq_set_split:Nnn {Nne}
\cs_generate_variant:Nn \tl_if_empty:nTF {x}
\cs_generate_variant:Nn \seq_set_split:Nnn {Nnx}

\cs_new:Npn \__bithesis_same_page: {
\let\clearpage\relax
Expand Down Expand Up @@ -206,6 +205,8 @@
cover .meta:nn = { bithesis / cover } {#1},
style .meta:nn = { bithesis / style } {#1},
option .meta:nn = { bithesis / option } {#1},
TOC .meta:nn = { bithesis / TOC } {#1},
appendices .meta:nn = { bithesis / appendices } {#1},
}

\keys_define:nn { bithesis / option }
Expand Down Expand Up @@ -301,7 +302,24 @@
{4} {北京理工大学硕士学位论文}
{5} {北京理工大学博士学位论文}
}
}
},
}

\keys_define:nn { bithesis / 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},
symbols .bool_set:N = \l__bithesis_add_symbols_to_toc_bool,
symbols .initial:n = {true},
}

\keys_define:nn { bithesis / appendices }
{
chapterLevel .bool_set:N = \l__bithesis_appendices_chapter_level_bool,
title .tl_set:N = \l__bithesis_appendices_title_tl,
TOCTitle .tl_set:N = \l__bithesis_appendix_toc_title_tl,
}

\ProcessKeysOptions { bithesis / option }
Expand Down Expand Up @@ -338,6 +356,8 @@
\RequirePackage{array}
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{amsthm}
\RequirePackage{unicode-math}
\RequirePackage{pdfpages}
\RequirePackage{listings}
\RequirePackage{enumitem}
Expand Down Expand Up @@ -511,38 +531,6 @@
{\thecontentslabel\hspace{\ccwd}}{}
{\hspace{.5em}\titlerule*{.}\contentspage}

\bool_new:N \l__bithesis_add_to_toc_bool
\bool_set_true:N \l__bithesis_add_to_toc_bool

\keys_define:nn { bit }
{
abstract .meta:nn = { bit / abstract } {#1},
abstract_en .meta:nn = { bit / abstract_en } {#1},
symbols .meta:nn = { bit / symbols } {#1},
appendices .meta:nn = { bit / appendices } {#1},
}

\keys_define:nn { bit / abstract }
{
addTOC .bool_set:N = \l__bithesis_add_to_toc_bool,
}

\keys_define:nn { bit / abstract_en }
{
addTOC .bool_set:N = \l__bithesis_add_to_toc_bool,
}

\keys_define:nn { bit / symbols }
{
addTOC .bool_set:N = \l__bithesis_add_to_toc_bool,
}

\keys_define:nn { bit / appendices }
{
chapterLevel .bool_set:N = \l__bithesis_appendices_chapter_level_bool,
title .tl_set:N = \l__bithesis_appendices_title_tl,
TOCTitle .tl_set:N = \l__bithesis_appendix_toc_title_tl,
}

\RenewDocumentCommand \frontmatter {} {

Expand Down Expand Up @@ -645,6 +633,27 @@

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\unimathsetup{
math-style = ISO,
bold-style = ISO,
}

\theoremstyle{plain}
\newtheorem{algorithm}{算法}[chapter]
\newtheorem{theorem}{定理}[chapter]
\newtheorem{lemma}[theorem]{引理}
\newtheorem{proposition}[theorem]{命题}
\newtheorem{corollary}[theorem]{推论}
\newtheorem{axiom}[theorem]{公理}
\theoremstyle{definition}
\newtheorem{definition}{定义}[chapter]
\newtheorem{conjecture}{猜想}[chapter]
\newtheorem{example}{例}[chapter]
\newtheorem{case}{情形}
\theoremstyle{remark}
\newtheorem{remark}{注}
\renewcommand{\qedsymbol}{\ensuremath{\QED}}

\DeclareDocumentCommand \BITSetup { m }
{ \keys_set:nn { bithesis } { #1 }}

Expand Down Expand Up @@ -680,7 +689,7 @@
}

\cs_new:Npn \__bithesis_parse_entry #1 #2 {
\seq_set_split:Nne \l__bithesis_tmp_right_seq {//} {#2}
\seq_set_split:Nnx \l__bithesis_tmp_right_seq {//} {#2}
\seq_clear:N \l__bithesis_tmp_left_seq
\seq_map_inline:Nn \l__bithesis_tmp_right_seq {
\seq_put_right:Nn \l__bithesis_tmp_left_seq {}
Expand Down Expand Up @@ -708,7 +717,7 @@
{
\seq_pop_left:NN \l__bithesis_left_seq \l__bithesis_tmpa_tl
\seq_pop_left:NN \l__bithesis_right_seq \l__bithesis_tmpb_tl
\tl_if_empty:eTF \l__bithesis_tmpb_tl {} {
\tl_if_empty:xTF \l__bithesis_tmpb_tl {} {
\__bithesis_render_cover_entry:nn {\l__bithesis_tmpa_tl} {\l__bithesis_tmpb_tl}
}
}
Expand Down Expand Up @@ -1314,13 +1323,9 @@
}

% TODO:
\NewDocumentEnvironment {abstract} {o}
\NewDocumentEnvironment {abstract} {}
{

\IfValueT {#1} {
\keys_set:nn { bit / abstract } {#1}
}

\cleardoublepage
\setstretch{1.53}

Expand Down Expand Up @@ -1352,7 +1357,7 @@

{
\__bithesis_same_page:
\bool_if:NTF \l__bithesis_add_to_toc_bool {
\bool_if:NTF \l__bithesis_add_abstract_to_toc_bool {
\chapter{\c__bithesis_label_abstract_tl}
} {
\chapter*{\c__bithesis_label_abstract_tl}
Expand All @@ -1367,12 +1372,8 @@
\newpage
}

\NewDocumentEnvironment {abstractEn} {o}
\NewDocumentEnvironment {abstractEn} {}
{
\IfValueT {#1} {
\keys_set:nn { bit / abstract_en } {#1}
}

\cleardoublepage
\setstretch{1.53}

Expand Down Expand Up @@ -1417,7 +1418,7 @@

{
\__bithesis_same_page:
\bool_if:nTF {\l__bithesis_add_to_toc_bool} {
\bool_if:nTF {\l__bithesis_add_abstract_en_to_toc_bool} {
\chapter{\c__bithesis_label_abstract_en_tl}
} {
\chapter*{\c__bithesis_label_abstract_en_tl}
Expand Down Expand Up @@ -1474,12 +1475,8 @@

% #1: The name that used as chapter title
% #2: The name that used in ToC.
\NewDocumentEnvironment {appendices} {o}
\NewDocumentEnvironment {appendices} {}
{
\IfValueT {#1} {
\keys_set:nn { bit / appendices } {#1}
}

% Used in chapter, ToC.
\tl_new:N \l__bithesis_appendix_plain_label_tl
% Used before reference label.
Expand Down Expand Up @@ -1596,13 +1593,9 @@
{
}

\NewDocumentEnvironment {symbols} {o}
\NewDocumentEnvironment {symbols} {}
{
\IfValueT {#1} {
\keys_set:nn { bit / symbols } {#1}
}

\bool_if:NTF \l__bithesis_add_to_toc_bool {
\bool_if:NTF \l__bithesis_add_symbols_to_toc_bool {
\chapter{\c__bithesis_label_symbols_tl}
} {
\chapter*{\c__bithesis_label_symbols_tl}
Expand Down
4 changes: 2 additions & 2 deletions templates/graduate-thesis/chapters/abstract.tex
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
%
% The Current Maintainer of this work is Feng Kaiyu.

\begin{abstract}[addTOC=false]
\begin{abstract}
本文......。
\textcolor{blue}{(摘要是一篇具有独立性和完整性的短文,应概括而扼要地反映出本论文的主要内容。包括研究目的、研究方法、研究结果和结论等,特别要突出研究结果和结论。中文摘要力求语言精炼准确,博士学位论文建议1000~1200字,硕士学位论文摘要建议500~800字。摘要中不可出现参考文献、图、表、化学结构式、非公知公用的符号和术语。英文摘要与中文摘要的内容应完全一致,在语法、用词上应准确无误,语言简练通顺。留学生的英文版博士学位论文中应有不少于3000字的“详细中文摘要”。)}
\end{abstract}

\begin{abstractEn}[addTOC=false]
\begin{abstractEn}
In order to exploit.......
\end{abstractEn}
32 changes: 32 additions & 0 deletions templates/graduate-thesis/chapters/chapter2.tex
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,35 @@
\chapter{具体研究内容}

具体研究内容是学位论文的主要部分,是研究结果及其依据的具体表述,是研究能力的集中体现,一般应包括第2章、第3章至结论前一章。具体研究内容应该结构合理,层次清楚,重点突出,文字简练、通顺。可包括以下各方面:研究对象、研究方法、仪器设备、材料原料、实验和观测结果、理论推导、计算方法和编程原理、数据资料和经过加工整理的图表、理论分析、形成的论点和导出的结论等。具体研究内容各章后可有一节“本章小结”(必要时)。

\begin{theorem}[留数定理]
\label{thm:res}
假设$U$是复平面上的一个单连通开子集,$a_1,\ldots,a_n$是复平面上有限个点,$f$是定义在$U\backslash \{a_1,\ldots,a_n\}$上的全纯函数,
如果$\gamma$是一条把$a_1,\ldots,a_n$包围起来的可求长曲线,但不经过任何一个$a_k$,并且其起点与终点重合,那么:

\begin{equation}
\label{eq:res}
\ointop_{\gamma}f(z)\,\mathrm{d}z = 2\pi\mathbf{i}\sum^n_{k=1}\mathrm{I}(\gamma,a_k)\mathrm{Res}(f,a_k)
\end{equation}

如果$\gamma$是若尔当曲线,那么$\mathrm{I}(\gamma, a_k)=1$,因此:

\begin{equation}
\label{eq:resthm}
\ointop_{\gamma}f(z)\,\mathrm{d}z = 2\pi\mathbf{i}\sum^n_{k=1}\mathrm{Res}(f,a_k)
\end{equation}

在这里,$\mathrm{Res}(f, a_k)$表示$f$在点$a_k$的留数,$\mathrm{I}(\gamma,a_k)$表示$\gamma$关于点$a_k$的卷绕数。
卷绕数是一个整数,它描述了曲线$\gamma$绕过点$a_k$的次数。如果$\gamma$依逆时针方向绕着$a_k$移动,卷绕数就是一个正数,
如果$\gamma$根本不绕过$a_k$,卷绕数就是零。
\end{theorem}

\begin{proof}
首先,由……

其次,……

所以……
\qedhere
\end{proof}

10 changes: 9 additions & 1 deletion templates/graduate-thesis/main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,15 @@
keywordsEn = shape memory properties; polyurethane; textile; synthesis; application,
% 必要时置于封面右上角,并按照国家规定进行标记。
% classifiedLevel = 密级 $\bigstar$ 保密期限,
}
},
% 在目录页中不显示摘要和主要符号对照表的标题。
TOC = {
abstract = false,
abstractEn = false,
symbols = false,
},
% 采用章节标题级别的附录格式
appendices / chapterLevel = true,
}

\usepackage[
Expand Down
2 changes: 1 addition & 1 deletion templates/graduate-thesis/misc/0_symbols.tex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
%
% The Current Maintainer of this work is Feng Kaiyu.

\begin{symbols}[addTOC=false]
\begin{symbols}
\item[BIT] 北京理工大学的英文缩写
\item[\LaTeX] 一个很棒的排版系统
\item[\LaTeXe] 一个很棒的排版系统的最新稳定版
Expand Down
2 changes: 1 addition & 1 deletion templates/graduate-thesis/misc/3_appendices.tex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
%
% The Current Maintainer of this work is Feng Kaiyu.

\begin{appendices}[chapterLevel=true]
\begin{appendices}
\chapter{费马大定理的证明}
关于此,我确信已发现了一种美妙的证法,可惜这里空白的地方太小,写不下。

Expand Down
9 changes: 4 additions & 5 deletions templates/lab-report/bitreport.cls
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
\RequirePackage{expl3,l3keys2e}
\ProvidesExplClass{bitreport}
{2022-06-10}{3.0.0}{BIT Thesis Templates}
%%%% TODO:


\int_new:N \g__bithesis_report_type_int
Expand Down Expand Up @@ -114,8 +113,8 @@

\ProcessKeysOptions { bitreport / option }

\cs_generate_variant:Nn \tl_if_empty:nTF {e}
\cs_generate_variant:Nn \seq_set_split:Nnn {Nne}
\cs_generate_variant:Nn \tl_if_empty:nTF {x}
\cs_generate_variant:Nn \seq_set_split:Nnn {Nnx}

\cs_new:Npn \__bithesis_dunderline:nnn #1#2#3 {
{\setbox0=\hbox{#3}\ooalign{\copy0\cr\rule[\dimexpr#1-#2\relax]{\wd0}{#2}}}
Expand Down Expand Up @@ -153,7 +152,7 @@
}

\cs_new:Npn \__bithesis_parse_entry #1 #2 {
\seq_set_split:Nne \l__bithesis_tmp_right_seq {//} {#2}
\seq_set_split:Nnx \l__bithesis_tmp_right_seq {//} {#2}
\seq_clear:N \l__bithesis_tmp_left_seq
\seq_map_inline:Nn \l__bithesis_tmp_right_seq {
\seq_put_right:Nn \l__bithesis_tmp_left_seq {}
Expand Down Expand Up @@ -181,7 +180,7 @@
{
\seq_pop_left:NN \l__bithesis_left_seq \l__bithesis_tmpa_tl
\seq_pop_left:NN \l__bithesis_right_seq \l__bithesis_tmpb_tl
\tl_if_empty:eTF \l__bithesis_tmpb_tl {} {
\tl_if_empty:xTF \l__bithesis_tmpb_tl {} {
\__bithesis_render_cover_entry:nn {\l__bithesis_tmpa_tl} {\l__bithesis_tmpb_tl}
}
}
Expand Down
Loading

0 comments on commit 4d4fb55

Please sign in to comment.