|
| 1 | +\RequirePackage{expl3, l3keys2e} |
| 2 | +\ProvidesExplClass{bitundergrad}{ |
| 3 | + 2022-06-10 |
| 4 | +}{0.0.1}{BIThesis Undergraduate Thesis class} |
| 5 | + |
| 6 | +\PassOptionsToPackage{AutoFakeBold,AutoFakeSlant}{xeCJK} |
| 7 | + |
| 8 | +% Pass every option not explicitly defined to `ctexbeamer`. |
| 9 | +\DeclareOption*{ |
| 10 | + \PassOptionsToClass{\CurrentOption}{ctexbook} |
| 11 | +} |
| 12 | +% Executes the code for each option. |
| 13 | +\ProcessOptions\relax |
| 14 | +% Load |
| 15 | +\LoadClass[zihao=-4,oneside,openany]{ctexbook} |
| 16 | + |
| 17 | +\RequirePackage[a4paper,left=3cm,right=2.6cm,top=3.5cm,bottom=2.9cm]{geometry} |
| 18 | +\RequirePackage{xeCJK} |
| 19 | +\RequirePackage{titletoc} |
| 20 | +\RequirePackage{setspace} |
| 21 | +\RequirePackage{graphicx} |
| 22 | +\RequirePackage{fancyhdr} |
| 23 | +\RequirePackage{pdfpages} |
| 24 | +\RequirePackage{setspace} |
| 25 | +\RequirePackage{booktabs} |
| 26 | +\RequirePackage{multirow} |
| 27 | +\RequirePackage{tikz} |
| 28 | +\RequirePackage{etoolbox} |
| 29 | +\RequirePackage{hyperref} |
| 30 | +\RequirePackage{xcolor} |
| 31 | +\RequirePackage{caption} |
| 32 | +\RequirePackage{array} |
| 33 | +\RequirePackage{amsmath} |
| 34 | +\RequirePackage{amssymb} |
| 35 | +\RequirePackage{pdfpages} |
| 36 | +\RequirePackage{listings} |
| 37 | + |
| 38 | +% key-value interface definition. |
| 39 | +% \keys_define:nn { bitundergrad } |
| 40 | +% { |
| 41 | +% cover .meta:nn = { bitundergrad / cover } {#1}, |
| 42 | +% info .meta:nn = { bitundergrad / info } {#1}, |
| 43 | +% misc .meta:nn = { bitundergrad / misc } {#1} |
| 44 | +% } |
| 45 | +% |
| 46 | +% \keys_define:nn { bitundergrad / cover } |
| 47 | +% { |
| 48 | +% date .tl_set:N = \l_bit_coverdate_tl, |
| 49 | +% } |
| 50 | +% |
| 51 | +% \keys_define:nn { bitundergrad / info } |
| 52 | +% { |
| 53 | +% dept .tl_set:N = \l_bit_dept_tl, |
| 54 | +% major .tl_set:N = \l_bit_major_tl, |
| 55 | +% class .tl_set:N = \l_bit_class_tl, |
| 56 | +% name .tl_set:N = \l_bit_name_tl, |
| 57 | +% mentor .tl_set:N = \l_bit_mentor_tl, |
| 58 | +% offCampusMentor .tl_set:N = \l_bit_offcampusmentor_tl, |
| 59 | +% } |
| 60 | +% |
| 61 | +% \keys_define:nn { bitundergrad / misc } |
| 62 | +% { |
| 63 | +% reviewTable .tl_set:N = \l_bit_reviewtable_tl, |
| 64 | +% } |
| 65 | + |
| 66 | +\setromanfont{Times~New~Roman} |
| 67 | +% TODO: set optional or remove this |
| 68 | +\setCJKfamilyfont{xihei}[AutoFakeBold,AutoFakeSlant]{[STXIHEI.TTF]} % 若希望使用本机字体,也可以用 {STXihei} 来调用 |
| 69 | +\newcommand{\xihei}{\CJKfamily{xihei}} |
| 70 | + |
| 71 | +\newcommand{\arabicHeiti}[1]{#1} |
| 72 | + |
| 73 | +% TODO: custom title |
| 74 | +\fancypagestyle{BIThesis}{ |
| 75 | + % 页眉高度 |
| 76 | + \setlength{\headheight}{20pt} |
| 77 | + % 页码高度(不完美,比规定稍微靠下 2mm) |
| 78 | + \setlength{\footskip}{24pt} |
| 79 | + |
| 80 | + \fancyhf{} |
| 81 | + % 定义页眉、页码 |
| 82 | + \fancyhead[C]{\zihao{4}\ziju{0.08}\songti{北京理工大学本科生毕业设计(论文)}} |
| 83 | + \fancyfoot[C]{\songti\zihao{5} \thepage} |
| 84 | + % 页眉分割线稍微粗一些 |
| 85 | + \renewcommand{\headrulewidth}{0.6pt} |
| 86 | +} |
| 87 | + |
| 88 | +\ctexset{chapter={ |
| 89 | + name = {第,章}, |
| 90 | + number = {\arabicHeiti{ \arabic{chapter} }}, |
| 91 | + format = {\heiti \bfseries \centering \zihao{3}}, |
| 92 | + aftername = \hspace{9bp}, |
| 93 | + pagestyle = BIThesis, |
| 94 | + beforeskip = 8bp, |
| 95 | + afterskip = 32bp, |
| 96 | + fixskip = true, |
| 97 | + } |
| 98 | +} |
| 99 | + |
| 100 | +\ctexset{section={ |
| 101 | + number = {\arabicHeiti{\thechapter.\hspace{1bp}\arabic{section}}}, |
| 102 | + format = {\heiti \raggedright \bfseries \zihao{4}}, |
| 103 | + aftername = \hspace{8bp}, |
| 104 | + beforeskip = 20bp plus 1ex minus .2ex, |
| 105 | + afterskip = 18bp plus .2ex, |
| 106 | + fixskip = true, |
| 107 | + } |
| 108 | +} |
| 109 | + |
| 110 | +\ctexset{subsection={ |
| 111 | + number = {\arabicHeiti{\thechapter.\hspace{1bp}\arabic{section}.\hspace{1bp}\arabic{subsection}}}, |
| 112 | + format = {\heiti \bfseries \raggedright \zihao{-4}}, |
| 113 | + aftername = \hspace{7bp}, |
| 114 | + beforeskip = 17bp plus 1ex minus .2ex, |
| 115 | + afterskip = 14bp plus .2ex, |
| 116 | + fixskip = true, |
| 117 | + } |
| 118 | +} |
| 119 | + |
| 120 | +\addtocontents{toc}{\protect\hypersetup{hidelinks}} |
| 121 | + |
| 122 | +\renewcommand{\contentsname}{ |
| 123 | + \fontsize{16pt}{\baselineskip} |
| 124 | + \normalfont\heiti{目\hspace{1em}录} |
| 125 | + \vspace{-8pt} |
| 126 | +} |
| 127 | +\titlecontents{chapter}[0pt]{\songti \zihao{-4}} |
| 128 | +{\thecontentslabel\hspace{\ccwd}}{} |
| 129 | +{\hspace{.5em}\titlerule*{.}\contentspage} |
| 130 | +\titlecontents{section}[1\ccwd]{\songti \zihao{-4}} |
| 131 | +{\thecontentslabel\hspace{\ccwd}}{} |
| 132 | +{\hspace{.5em}\titlerule*{.}\contentspage} |
| 133 | +\titlecontents{subsection}[2\ccwd]{\songti \zihao{-4}} |
| 134 | +{\thecontentslabel\hspace{\ccwd}}{} |
| 135 | +{\hspace{.5em}\titlerule*{.}\contentspage} |
| 136 | + |
| 137 | +\renewcommand{\frontmatter}{ |
| 138 | + \pagenumbering{Roman} |
| 139 | + \pagestyle{BIThesis} |
| 140 | +} |
| 141 | + |
| 142 | +\renewcommand{\mainmatter}{ |
| 143 | + \pagenumbering{arabic} |
| 144 | + \pagestyle{BIThesis} |
| 145 | +} |
| 146 | + |
| 147 | +\setlength{\abovecaptionskip}{11pt} |
| 148 | +\setlength{\belowcaptionskip}{9pt} |
| 149 | + |
| 150 | +\AtBeginDocument{ |
| 151 | + \renewcommand{\lstlistingname}{代码} |
| 152 | + \renewcommand{\thelstlisting}{\arabic{chapter}-\arabic{lstlisting}} |
| 153 | +} |
| 154 | + |
| 155 | +\definecolor{codegreen}{rgb}{0,0.6,0} |
| 156 | +\definecolor{codegray}{rgb}{0.5,0.5,0.5} |
| 157 | +\definecolor{codepurple}{rgb}{0.58,0,0.82} |
| 158 | +\definecolor{backcolour}{rgb}{0.95,0.95,0.92} |
| 159 | +\lstdefinestyle{examplestyle}{ |
| 160 | + backgroundcolor=\color{backcolour}, |
| 161 | + commentstyle=\color{codegreen}, |
| 162 | + keywordstyle=\color{magenta}, |
| 163 | + numberstyle=\tiny\color{codegray}, |
| 164 | + stringstyle=\color{codepurple}, |
| 165 | + basicstyle=\ttfamily\footnotesize, |
| 166 | + breakatwhitespace=false, |
| 167 | + breaklines=true, |
| 168 | + captionpos=b, |
| 169 | + keepspaces=true, |
| 170 | + numbers=left, |
| 171 | + numbersep=5pt, |
| 172 | + showspaces=false, |
| 173 | + showstringspaces=false, |
| 174 | + showtabs=false, |
| 175 | + tabsize=2 |
| 176 | +} |
| 177 | +\lstset{style=examplestyle} |
| 178 | + |
| 179 | +% figure |
| 180 | + |
| 181 | +\renewcommand{\thefigure}{\thechapter-\arabic{figure}} |
| 182 | +\captionsetup[figure]{font=small,labelsep=space} |
| 183 | + |
| 184 | + |
| 185 | +% table |
| 186 | +\renewcommand{\thetable}{\thechapter-\arabic{table}} |
| 187 | +\captionsetup[table]{font=small,labelsep=space,skip=2pt} |
| 188 | + |
| 189 | +% equation |
| 190 | +\renewcommand{\theequation}{\arabic{chapter}-\arabic{equation}} |
| 191 | + |
| 192 | +\tolerance=1 |
| 193 | +\emergencystretch=\maxdimen |
| 194 | +\hyphenpenalty=10000 |
| 195 | +\hbadness=10000 |
| 196 | + |
| 197 | + |
| 198 | +\newcommand{\unnumchapter}[1]{ |
| 199 | + \chapter*{\vskip 10bp\textmd{#1} \vskip -6bp} |
| 200 | + \addcontentsline{toc}{chapter}{#1} |
| 201 | + \stepcounter{chapter} |
| 202 | +} |
| 203 | + |
| 204 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 205 | + |
| 206 | +% user interface. |
| 207 | +\DeclareDocumentCommand \BITProposalSetup { m } |
| 208 | + { \keys_set:nn { bitundergrad } { #1 }} |
| 209 | +\DeclareDocumentCommand \MakeCover {} |
| 210 | + { |
| 211 | + \group_begin: |
| 212 | + \group_end: |
| 213 | + } |
| 214 | + |
| 215 | +\DeclareDocumentCommand \MakeReviewTable {} |
| 216 | + { |
| 217 | + \group_begin: |
| 218 | + \group_end: |
| 219 | + } |
0 commit comments