| 1 |
% \iffalse |
| 2 |
% |
| 3 |
\ProvidesPackage{dtx-style} |
| 4 |
\RequirePackage{hypdoc} |
| 5 |
\RequirePackage{ifthen} |
| 6 |
\RequirePackage[quiet]{fontspec} |
| 7 |
\RequirePackage{amsmath} |
| 8 |
\RequirePackage{unicode-math} |
| 9 |
\RequirePackage[UTF8,scheme=chinese,heading,sub3section]{ctex} |
| 10 |
\RequirePackage[ |
| 11 |
top=2.5cm, bottom=2.5cm, |
| 12 |
left=5cm, right=2cm, |
| 13 |
headsep=3mm]{geometry} |
| 14 |
\RequirePackage{graphicx} |
| 15 |
\RequirePackage{multirow} |
| 16 |
\RequirePackage{wrapfig} |
| 17 |
\RequirePackage{hologo} |
| 18 |
\RequirePackage{array,longtable,booktabs} |
| 19 |
\RequirePackage{listings} |
| 20 |
\RequirePackage{fancyhdr} |
| 21 |
\RequirePackage[dvipsnames,table,xcdraw]{xcolor} |
| 22 |
\RequirePackage{awesomebox} |
| 23 |
% \RequirePackage{etoolbox} |
| 24 |
\RequirePackage{dirtree} |
| 25 |
\RequirePackage{metalogo} |
| 26 |
% The markdown package uses lt3luabridge, which is also required. |
| 27 |
\RequirePackage[tightLists=false]{markdown} |
| 28 |
\RequirePackage{caption} |
| 29 |
\RequirePackage{tikz} |
| 30 |
\usetikzlibrary{positioning} |
| 31 |
\RequirePackage{framed} |
| 32 |
\RequirePackage{menukeys} |
| 33 |
\RequirePackage{float} |
| 34 |
\RequirePackage{subfig} |
| 35 |
|
| 36 |
% 设置列表无间隔 |
| 37 |
\usepackage{enumitem} |
| 38 |
\setlist{nosep} |
| 39 |
|
| 40 |
\markdownSetup{ |
| 41 |
renderers = { |
| 42 |
link = {\href{#2}{#1}}, |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
\hypersetup{ |
| 47 |
pdflang = zh-CN, |
| 48 |
pdftitle = {BIThesis:北京理工大学学位论文及报告模板}, |
| 49 |
pdfauthor = {冯开宇}, |
| 50 |
pdfsubject = {北京理工大学学位论文及报告模板使用说明}, |
| 51 |
pdfkeywords = {论文模板; 北京理工大学; 使用说明}, |
| 52 |
pdfdisplaydoctitle = true |
| 53 |
}% |
| 54 |
|
| 55 |
\renewcommand{\subsectionautorefname}{小节} |
| 56 |
\renewcommand{\subsubsectionautorefname}{小节} |
| 57 |
\renewcommand{\sectionautorefname}{节} |
| 58 |
\renewcommand{\chapterautorefname}{章} |
| 59 |
|
| 60 |
\newcommand{\BIThesisLaTeX}{{\BIThesis}北京理工大学学位论文及报告{\LaTeX}模板} |
| 61 |
\newcommand{\BIThesisMacroPackage}{{\BIThesis}宏包} |
| 62 |
\newcommand{\BIThesisWiki}{{\BIThesis}在线文档} |
| 63 |
\newcommand{\BIThesisScaffold}{{\BIThesis}模板} |
| 64 |
\newcommand{\BIThesisRelease}{{\BIThesis}模板} |
| 65 |
\newcommand{\LPPL}{{\href{https://www.latex-project.org/lppl/lppl-1-3c.txt}{\LaTeX{} Project Public License (1.3.c)}}} |
| 66 |
\newcommand{\versionold}{v2.0 BirthdayCake} |
| 67 |
\newcommand{\version}{v3 Summer Time} |
| 68 |
|
| 69 |
\ExplSyntaxOn |
| 70 |
|
| 71 |
\AtBeginEnvironment { bitsyntax } { |
| 72 |
\cs_set:Npn \lparen { \textup { ( } } |
| 73 |
\cs_set:Npn \rparen { \textup { ) } } |
| 74 |
\char_set_catcode_active:N | |
| 75 |
\char_set_catcode_active:N < |
| 76 |
\char_set_catcode_active:N ( |
| 77 |
\char_set_active_eq:NN | \orbar |
| 78 |
\char_set_active_eq:NN < \syntaxopt@aux |
| 79 |
\char_set_active_eq:NN ( \defaultval@aux |
| 80 |
} |
| 81 |
|
| 82 |
\NewDocumentCommand \BIThesisTemplates {m} { |
| 83 |
\str_case:nn {#1} { |
| 84 |
{UT}{本科生毕业论文模板(undergraduate-thesis)} |
| 85 |
{UTE}{本科生全英文专业毕业论文模板(undergraduate-thesis-en)} |
| 86 |
{GT}{研究生学位论文模板(graduate-thesis)} |
| 87 |
{LR}{简易实验报告模板(lab-report)} |
| 88 |
{PT}{本科生毕业设计外文翻译模板(paper-translation)} |
| 89 |
{PS}{北理工主题的 Beamer 模板(presentation-slide)} |
| 90 |
{UP}{本科生毕业设计开题报告(undergraduate-proposal,已废弃)} |
| 91 |
{RR}{本科生读书报告模板(reading-report)} |
| 92 |
} |
| 93 |
} |
| 94 |
|
| 95 |
% 允许换行的细间距。 |
| 96 |
\def\breakablethinspace{\hskip 0.16667em\relax} |
| 97 |
|
| 98 |
|
| 99 |
\DeclareDocumentCommand\kvopt{mm} |
| 100 |
{\texttt{#1\breakablethinspace=\breakablethinspace#2}} |
| 101 |
|
| 102 |
\ExplSyntaxOff |
| 103 |
|
| 104 |
\ctexset{ |
| 105 |
today=big, |
| 106 |
abstractname=简介, |
| 107 |
} |
| 108 |
|
| 109 |
\pagestyle{fancy} |
| 110 |
|
| 111 |
\ctexset{section={ |
| 112 |
format={\raggedright \bfseries \zihao{-3}}, |
| 113 |
name = {第,章} |
| 114 |
} |
| 115 |
} |
| 116 |
|
| 117 |
\ctexset{subsection={ |
| 118 |
format = {\bfseries \raggedright \zihao{4}} |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
\ifthenelse{\equal{\@nameuse{g__ctex_fontset_tl}}{mac}}{ |
| 123 |
\setmainfont{Palatino} |
| 124 |
\setsansfont[Scale=MatchLowercase]{Helvetica} |
| 125 |
\setmonofont[Scale=MatchLowercase]{Menlo} |
| 126 |
\xeCJKsetwidth{‘’“”}{1em} |
| 127 |
}{ |
| 128 |
\setmainfont[ |
| 129 |
Extension = .otf, |
| 130 |
UprightFont = *-regular, |
| 131 |
BoldFont = *-bold, |
| 132 |
ItalicFont = *-italic, |
| 133 |
BoldItalicFont = *-bolditalic, |
| 134 |
]{texgyrepagella} |
| 135 |
\setsansfont[ |
| 136 |
Extension = .otf, |
| 137 |
UprightFont = *-regular, |
| 138 |
BoldFont = *-bold, |
| 139 |
ItalicFont = *-italic, |
| 140 |
BoldItalicFont = *-bolditalic, |
| 141 |
]{texgyreheros} |
| 142 |
\setmonofont[ |
| 143 |
Extension = .otf, |
| 144 |
UprightFont = *-regular, |
| 145 |
BoldFont = *-bold, |
| 146 |
ItalicFont = *-italic, |
| 147 |
BoldItalicFont = *-bolditalic, |
| 148 |
Scale = MatchLowercase, |
| 149 |
Ligatures = CommonOff, |
| 150 |
]{texgyrecursor} |
| 151 |
} |
| 152 |
\unimathsetup{ |
| 153 |
math-style=ISO, |
| 154 |
bold-style=ISO, |
| 155 |
} |
| 156 |
\IfFontExistsTF{XITSMath-Regular.otf}{ |
| 157 |
\setmathfont[ |
| 158 |
Extension = .otf, |
| 159 |
BoldFont = XITSMath-Bold, |
| 160 |
StylisticSet = 8, |
| 161 |
]{XITSMath-Regular} |
| 162 |
\setmathfont[range={cal,bfcal},StylisticSet=1]{XITSMath-Regular.otf} |
| 163 |
}{ |
| 164 |
\setmathfont[ |
| 165 |
Extension = .otf, |
| 166 |
BoldFont = *bold, |
| 167 |
StylisticSet = 8, |
| 168 |
]{xits-math} |
| 169 |
\setmathfont[range={cal,bfcal},StylisticSet=1]{xits-math.otf} |
| 170 |
} |
| 171 |
|
| 172 |
\colorlet{bit@macro}{blue!60!black} |
| 173 |
\colorlet{bit@env}{blue!70!black} |
| 174 |
\colorlet{bit@option}{purple} |
| 175 |
\patchcmd{\PrintMacroName}{\MacroFont}{\MacroFont\bfseries\color{bit@macro}}{}{} |
| 176 |
\patchcmd{\PrintDescribeMacro}{\MacroFont}{\MacroFont\bfseries\color{bit@macro}}{}{} |
| 177 |
\patchcmd{\PrintDescribeEnv}{\MacroFont}{\MacroFont\bfseries\color{bit@env}}{}{} |
| 178 |
\patchcmd{\PrintEnvName}{\MacroFont}{\MacroFont\bfseries\color{bit@env}}{}{} |
| 179 |
|
| 180 |
\def\DescribeOption{% |
| 181 |
\leavevmode\@bsphack\begingroup\MakePrivateLetters% |
| 182 |
\Describe@Option} |
| 183 |
\def\Describe@Option#1{\endgroup |
| 184 |
\marginpar{\raggedleft\PrintDescribeOption{#1}}% |
| 185 |
\bit@special@index{option}{#1}\@esphack\ignorespaces} |
| 186 |
\def\PrintDescribeOption#1{\strut \MacroFont\bfseries\sffamily\color{bit@option} #1\ } |
| 187 |
\def\bit@special@index#1#2{\@bsphack |
| 188 |
\begingroup |
| 189 |
\HD@target |
| 190 |
\let\HDorg@encapchar\encapchar |
| 191 |
\edef\encapchar usage{% |
| 192 |
\HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}% |
| 193 |
}% |
| 194 |
\index{#2\actualchar{\string\ttfamily\space#2} |
| 195 |
(#1)\encapchar usage}% |
| 196 |
\index{#1:\levelchar#2\actualchar |
| 197 |
{\string\ttfamily\space#2}\encapchar usage}% |
| 198 |
\endgroup |
| 199 |
\@esphack} |
| 200 |
|
| 201 |
\lstdefinestyle{lstStyleBase}{% |
| 202 |
basicstyle=\small\ttfamily, |
| 203 |
aboveskip=\medskipamount, |
| 204 |
belowskip=\medskipamount, |
| 205 |
lineskip=0pt, |
| 206 |
boxpos=c, |
| 207 |
showlines=false, |
| 208 |
extendedchars=true, |
| 209 |
escapeinside = {(*}{*)}, |
| 210 |
upquote=true, |
| 211 |
tabsize=2, |
| 212 |
showtabs=false, |
| 213 |
showspaces=false, |
| 214 |
showstringspaces=false, |
| 215 |
numbers=none, |
| 216 |
linewidth=\linewidth, |
| 217 |
xleftmargin=4pt, |
| 218 |
xrightmargin=0pt, |
| 219 |
resetmargins=false, |
| 220 |
breaklines=true, |
| 221 |
breakatwhitespace=false, |
| 222 |
breakindent=0pt, |
| 223 |
breakautoindent=true, |
| 224 |
columns=flexible, |
| 225 |
keepspaces=true, |
| 226 |
gobble=0, |
| 227 |
framesep=3pt, |
| 228 |
rulesep=1pt, |
| 229 |
framerule=1pt, |
| 230 |
backgroundcolor=\color{gray!5}, |
| 231 |
stringstyle=\color{green!40!black!100}, |
| 232 |
keywordstyle=\bfseries\color{blue!50!black}, |
| 233 |
commentstyle=\slshape\color{black!60}} |
| 234 |
|
| 235 |
\lstdefinestyle{lstStyleShell}{% |
| 236 |
style=lstStyleBase, |
| 237 |
frame=l, |
| 238 |
rulecolor=\color{purple}, |
| 239 |
language=bash, |
| 240 |
} |
| 241 |
|
| 242 |
\lstdefinestyle{lstStyleLaTeX}{% |
| 243 |
style=lstStyleBase, |
| 244 |
frame=l, |
| 245 |
rulecolor=\color{violet}, |
| 246 |
language=[LaTeX]TeX, |
| 247 |
emphstyle=[1]\color{teal}, |
| 248 |
} |
| 249 |
|
| 250 |
\lstdefinestyle{lstStyleSyntax}{% |
| 251 |
style=lstStyleBase, |
| 252 |
frame=l, |
| 253 |
rulecolor=\color{violet}, |
| 254 |
language=[LaTeX]TeX, |
| 255 |
emphstyle=[1]\color{teal}, |
| 256 |
} |
| 257 |
|
| 258 |
\lstnewenvironment{latex}[1][]{\lstset{style=lstStyleLaTeX, #1}}{} |
| 259 |
\lstnewenvironment{shell}[1][]{\lstset{style=lstStyleShell, #1}}{} |
| 260 |
\lstnewenvironment{bitsyntax}[1][]{\lstset{style=lstStyleSyntax, #1}}{} |
| 261 |
|
| 262 |
\def\orbar{\textup{\textbar}} |
| 263 |
\def\syntaxopt#1{\textit{#1}} |
| 264 |
\def\defaultval#1{\textbf{\textup{#1}}} |
| 265 |
\def\syntaxopt@aux#1>{\syntaxopt{#1}} |
| 266 |
\def\defaultval@aux#1){\defaultval{#1}} |
| 267 |
|
| 268 |
|
| 269 |
\setlist{nosep} |
| 270 |
|
| 271 |
\DeclareDocumentCommand{\option}{m}{\textsf{#1}} |
| 272 |
\DeclareDocumentCommand{\env}{m}{\texttt{#1}} |
| 273 |
\newcommand{\myentry}[1]{% |
| 274 |
\marginpar{\raggedleft\color{purple}\bfseries\strut #1}} |
| 275 |
\newenvironment{note}[1][Note] |
| 276 |
{{\color{magenta} \bfseries #1} \itshape} |
| 277 |
{} |
| 278 |
|
| 279 |
\DeclareDocumentCommand{\githubuser}{m}{\href{https://github.com/#1}{@#1}} |
| 280 |
|
| 281 |
|
| 282 |
% 设置 caption 与 figure 之间的距离 |
| 283 |
\setlength{\abovecaptionskip}{11pt} |
| 284 |
\setlength{\belowcaptionskip}{9pt} |
| 285 |
|
| 286 |
% 设置图片的 caption 格式 |
| 287 |
\renewcommand{\thefigure}{\thesection-\arabic{figure}} |
| 288 |
\captionsetup[figure]{font=small,labelsep=space} |
| 289 |
|
| 290 |
% 设置表格的 caption 与 table 之间的垂直距离 |
| 291 |
\captionsetup[table]{skip=2pt} |
| 292 |
|
| 293 |
% 设置表格的 caption 格式 |
| 294 |
\renewcommand{\thetable}{\thesection-\arabic{table}} |
| 295 |
\captionsetup[table]{font=small,labelsep=space} |
| 296 |
|
| 297 |
% 定义 BIThesis \LaTeX 风格的 Logo |
| 298 |
\usepackage{relsize} |
| 299 |
\makeatletter |
| 300 |
\def\matex@ssize{\smaller\scshape} |
| 301 |
\DeclareRobustCommand{\BIThesis}{ |
| 302 |
\texorpdfstring{\mbox{ |
| 303 |
\kern-0.5em{B}\kern-0.05em |
| 304 |
{I}\kern-0.05em |
| 305 |
{T}\kern-0.1em |
| 306 |
\raisebox{-0.38ex}{\matex@ssize {H}}\kern-0.1em |
| 307 |
{\matex@ssize {E}}\kern-0.05em |
| 308 |
\raisebox{-0.38ex}{\matex@ssize {S}}\kern-0.05em |
| 309 |
{\matex@ssize {I}}\kern-0.05em |
| 310 |
\raisebox{-0.35ex}{\matex@ssize {S}}\kern-0.5em |
| 311 |
\kern 1ex |
| 312 |
}}{BIThesis} |
| 313 |
} |
| 314 |
|
| 315 |
%% from \pkg{ctxdoc} |
| 316 |
\newlist{optdesc}{description}{3} |
| 317 |
%% 设置间距为 \marginparsep,与 l3doc 一致 |
| 318 |
\setlist[optdesc]{% |
| 319 |
font=\mdseries\small\ttfamily,align=right,listparindent=\parindent, |
| 320 |
labelsep=\marginparsep,labelindent=-\marginparsep,leftmargin=0pt} |
| 321 |
|
| 322 |
\makeatother |
| 323 |
|
| 324 |
% \fi |