-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbitoc.sty
More file actions
132 lines (121 loc) · 4.15 KB
/
bitoc.sty
File metadata and controls
132 lines (121 loc) · 4.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bitoc}[2019/10/01 bilingual tableofcontents for bjutthesis.cls]
\RequirePackage{xparse}
\RequirePackage{hyperref}
\hypersetup{linktoc=all}
\RequirePackage[notintoc]{nomencl}
%% Names
\def\cabstractname{摘要}
\def\ccontentsname{目录}
\def\cnomname{术语表}
\def\cconclusionname{结论与展望}
\def\cbibname{参考文献}
\def\cappendixname{附录}
\def\cpubname{攻读博士学位期间所发表的学术论文}
\def\cackname{致谢}
\def\clistfigurename{插图目录}
\def\clisttablename{表格目录}
\def\eabstractname{Abstract}
\def\econtentsname{Contents}
\def\enomname{Nomenclature}
\def\echaptername{Chapter}
\def\econclusionname{Conclusions}
\def\ebibname{References}
\def\eappendixname{Appendix}
\def\epubname{Publications}
\def\eackname{Acknowledgement}
\def\elistfigurename{List of Figures}
\def\elisttablename{List of Tables}
%% NEW Commands
\NewDocumentCommand{\bichapter}{sO{}mm}{%
% O{} or #2 for set font of English chap entries in Chinese ToC with header normalfont
\IfBooleanTF{#1}
{\chapter*{#2#3}
\markboth{\MakeUppercase#3}{}
\addcontentsline{toc}{chapter}{#2#3}
\addcontentsline{toe}{chapter}{\bfseries#4}}
{\chapter{#3}
\addcontentsline{toe}{chapter}{\bfseries\echaptername~\thechapter~~#4}}}
\NewDocumentCommand{\bisection}{mm}{%
\section{#1}
\addcontentsline{toe}{section}{\thesection~~#2}}
\NewDocumentCommand{\bisubsection}{mm}{%
\subsection{#1}
\addcontentsline{toe}{subsection}{\thesubsection~~#2}}
\renewcommand{\appendixname}{\cappendixname}
\NewDocumentCommand{\biappendix}{mm}{%
\ctexset{chapter/format=\bjut@chapter@font\raggedright}
\chapter{#1}
\ctexset{chapter/format=\bjut@chapter@font\centering}
\addcontentsline{toe}{chapter}{\bfseries\eappendixname~\thechapter~~#2}}
%% ==== Make Bilingual ToC
\renewcommand\contentsname\ccontentsname
\newcommand{\makebitoc}{%
{\zihao{-4}\linespread{1.53}\selectfont\tableofcontents}\normalsize
\addcontentsline{toc}{chapter}{\ccontentsname}
\addcontentsline{toe}{chapter}{\bfseries\econtentsname~(in Chinese)}
\bichapter*[\bfseries]{\econtentsname}{\econtentsname}
{\zihao{-4}\linespread{1.53}\selectfont\@starttoc{toe}}\normalsize}
%% ==== Lists
\renewcommand\listfigurename\clistfigurename
\renewcommand\listtablename\clisttablename
\let\oldlistoffigures\listoffigures
\let\oldlistoftables\listoftables
\renewcommand\listoffigures{%
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{\clistfigurename}
\addcontentsline{toe}{chapter}{\bfseries\elistfigurename}
\oldlistoffigures}
\renewcommand\listoftables{
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{\clisttablename}
\addcontentsline{toe}{chapter}{\bfseries\elisttablename}
\oldlistoftables}
%% ==== Nomenclature
\renewcommand\nomname\cnomname
\makenomenclature
\let\oldprintnomenclature\printnomenclature
\renewcommand\printnomenclature{%
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{\cnomname}
\addcontentsline{toe}{chapter}{\bfseries\enomname}
\oldprintnomenclature}
% ==== Reference
\renewcommand\bibname\cbibname
\NewDocumentCommand{\makebib}{m}{%
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{\bibname}
\addcontentsline{toe}{chapter}{\bfseries\ebibname}
\bibliography{#1}}
%% ==== NEW Environments
% ==== Abstract Environment
\newcommand\ckeywords{%
\par
\vspace{12pt}
\noindent{\zihao{-4}\heiti 关键词:}\relax}
\newcommand\ekeywords{%
\par
\vspace{12pt}
\noindent{\zihao{-4}\bfseries Keywords:~}\relax}
\NewDocumentEnvironment{cabstract}{}{%
\bichapter*{\cabstractname}{\eabstractname~(in Chinese)}
}{\relax}
\NewDocumentEnvironment{eabstract}{}{%
\bichapter*[\bfseries]{\eabstractname}{\eabstractname}
}{\relax}
% ==== Conclusions Environment
\NewDocumentEnvironment{conclusion}{}{%
\bichapter*{\cconclusionname}{\econclusionname}
}{\relax}
% ==== Publication Environment
\NewDocumentEnvironment{publication}{}{%
\bichapter*{\cpubname}{\epubname}
}{\relax}
% ==== Acknowledgement Environment
\NewDocumentEnvironment{acknowledgement}{}{%
\bichapter*{\cackname}{\eackname}
}{\relax}