Debian Codegraph @

texmf-dist/tex/latex/shtthesis/shtthesis.cls

raw
1 % shtthesis, an unofficial LaTeX thesis template for ShanghaiTech University.
2 % Copyright (C) 2022 Li Rundong <[email protected]>
3 %
4 % This program is free software: you can redistribute it and/or modify
5 % it under the terms of the GNU General Public License as published by
6 % the Free Software Foundation, either version 3 of the License, or
7 % (at your option) any later version.
8 %
9 % This program is distributed in the hope that it will be useful,
10 % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 % GNU General Public License for more details.
13 %
14 % You should have received a copy of the GNU General Public License
15 % along with this program. If not, see <https://www.gnu.org/licenses/>
16 % ==============================================================================
17 % Identification
18 % ==============================================================================
19 \NeedsTeXFormat{LaTeX2e}
20 \newcommand\version{0.3.3}
21 \newcommand\versiondate{2022/03/03}
22 \ProvidesClass{shtthesis}[%
23 \versiondate\space%
24 v\version\space%
25 An Unofficial Thesis Template for ShanghaiTech University%
26 ]
27 \hyphenation{sht-thesis}
28 \hyphenation{Sht-Thesis}
29 \newcommand\shtthesis{\textup{\sffamily shtthesis}}
30 \newcommand\ShtThesis{\textup{\sffamily ShtThesis}}
31 \def\sht@compile@err@help{%
32 Pass `-pdflua' or `-pdfxe' option to `latexmk' on compilation.%
33 }
34 \newcommand\sht@error[2][\sht@compile@err@help]{\ClassError{shtthesis}{#2}{#1}}
35 \newcommand\sht@warning[1]{\ClassWarning{shtthesis}{#1}}
36 \RequirePackage{iftex}
37 \ifluatex\else\ifxetex\else%
38 \sht@error{shtthesis only works with LuaLaTeX or XeLaTeX}%
39 \fi\fi
40 % ==============================================================================
41 % Options and Declarations
42 % ==============================================================================
43 \RequirePackage{kvdefinekeys}
44 \RequirePackage{kvsetkeys}
45 \RequirePackage{kvoptions}
46 \RequirePackage{datetime}
47 % ------------------------------------------------------------------------------
48 % Define \shtsetup command
49 %
50 % Following key-value setup mechanism is adapted from `thuthesis'.
51 % thuthesis (https://github.com/xueruini/thuthesis) is licensed under the
52 % conditions of the LaTeX Project Public License, either version 1.3.
53 % ------------------------------------------------------------------------------
54 \newcommand\shtsetup{%
55 \kvsetkeys{sht}%
56 }
57 \newcommand\sht@define@key[1]{%
58 \kvsetkeys{sht@key}{#1}%
59 }
60 \kv@set@family@handler{sht@key}{%
61 \@namedef{sht@#1@@name}{#1}%
62 \def\sht@@default{}%
63 \def\sht@@choices{}%
64 \kv@define@key{sht@value}{name}{%
65 \@namedef{sht@#1@@name}{##1}%
66 }%
67 \kv@define@key{sht@value}{code}{%
68 \@namedef{sht@#1@@code}{##1}%
69 }%
70 \@namedef{sht@#1@@check}{}%
71 \@namedef{sht@#1@@code}{}%
72 \@namedef{sht@#1@@hook}{%
73 \expandafter\ifx\csname\@currname.\@currext-h@@k\endcsname\relax
74 \@nameuse{sht@#1@@code}%
75 \else
76 \AtEndOfClass{%
77 \@nameuse{sht@#1@@code}%
78 }%
79 \fi
80 }%
81 \kv@define@key{sht@value}{choices}{%
82 \def\sht@@choices{##1}%
83 \@namedef{sht@#1@@reset}{}%
84 \@namedef{sht@#1@@check}{%
85 \@ifundefined{%
86 ifsht@\@nameuse{sht@#1@@name}@\@nameuse{sht@\@nameuse{sht@#1@@name}}%
87 }{%
88 \sht@error{Invalid value "#1 = \@nameuse{sht@\@nameuse{sht@#1@@name}}"}%
89 }%
90 \@nameuse{sht@#1@@reset}%
91 \@nameuse{sht@\@nameuse{sht@#1@@name}@\@nameuse{sht@\@nameuse{sht@#1@@name}}true}%
92 }%
93 }%
94 \kv@define@key{sht@value}{default}{%
95 \def\sht@@default{##1}%
96 }%
97 \kvsetkeys{sht@value}{#2}%
98 \@namedef{sht@\@nameuse{sht@#1@@name}}{}%
99 \kv@set@family@handler{sht@choice}{%
100 \ifx\sht@@default\@empty
101 \def\sht@@default{##1}%
102 \fi
103 \expandafter\newif\csname ifsht@\@nameuse{sht@#1@@name}@##1\endcsname
104 \expandafter\g@addto@macro\csname sht@#1@@reset\endcsname{%
105 \@nameuse{sht@\@nameuse{sht@#1@@name}@##1false}%
106 }%
107 }%
108 \kvsetkeys@expandafter{sht@choice}{\sht@@choices}%
109 \expandafter\let\csname sht@\@nameuse{sht@#1@@name}\endcsname\sht@@default
110 \expandafter\ifx\csname sht@\@nameuse{sht@#1@@name}\endcsname\@empty\else
111 \@nameuse{sht@#1@@check}%
112 \@nameuse{sht@#1@@hook}%
113 \fi
114 \kv@define@key{sht}{#1}{%
115 \@namedef{sht@\@nameuse{sht@#1@@name}}{##1}%
116 \@nameuse{sht@#1@@check}%
117 \@nameuse{sht@#1@@hook}%
118 }%
119 }
120 % ------------------------------------------------------------------------------
121 % Options for \shtsetup
122 % ------------------------------------------------------------------------------
123 \sht@define@key{
124 degree-name = {
125 default = {工学博士},
126 name = degree@name,
127 },
128 degree-name* = {
129 default = {Doctor~of~Philosophy},
130 name = degree@name@en,
131 },
132 language = {
133 choices = {
134 chinese,
135 english,
136 },
137 },
138 secret-level = {
139 name = secret@level,
140 },
141 secret-year = {
142 name = secret@year,
143 },
144 title = {
145 default = {标题},
146 },
147 title* = {
148 default = {Title},
149 name = title@en,
150 },
151 keywords,
152 keywords* = {
153 name = keywords@en,
154 },
155 author = {
156 default = {姓名},
157 },
158 author* = {
159 default = {Name of author},
160 name = author@en,
161 },
162 author-id = {
163 default = {Id of author},
164 name = author@id,
165 },
166 entrance-year = {
167 default = {Year of entrance},
168 name = entrance@year,
169 },
170 supervisor = {
171 default = {导师姓名},
172 },
173 supervisor* = {
174 default = {Name of supervisor},
175 name = supervisor@en,
176 },
177 supervisor-institution = {
178 name = supervisor@institution,
179 },
180 supervisor-institution* = {
181 name = supervisor@institution@en,
182 },
183 institution = {
184 % default = {上海科技大学信息科学与技术学院},
185 },
186 institution* = {
187 % default = {%
188 % School~of~Information~Science~and~Technology\\%
189 % ShanghaiTech~University%
190 % },
191 name = institution@en
192 },
193 discipline = {
194 % default = {计算机科学与技术},
195 },
196 discipline* = {
197 % default = {Computer Science and Technology},
198 name = discipline@en,
199 },
200 discipline-level-1 = {
201 default = {一级学科名称},
202 name = discipline@level@i,
203 },
204 discipline-level-1* = {
205 default = {Name of Level-one Discipline},
206 name = discipline@level@i@en,
207 },
208 discipline-level-2 = {
209 default = {二级学科名称},
210 name = discipline@level@ii,
211 },
212 discipline-level-2* = {
213 default = {Name of Level-two Discipline},
214 name = discipline@level@ii@en,
215 },
216 date = {
217 default = {\the\year~年~\the\month~月},
218 },
219 date* = {
220 default = {\monthname,~\the\year},
221 name = date@en,
222 },
223 clc,
224 udc,
225 id,
226 anonymous-str = {
227 name = anonymous@str,
228 default = {***},
229 },
230 bib-resource = {
231 name = bib@resource,
232 }
233 }
234 % ------------------------------------------------------------------------------
235 % Class options
236 % ------------------------------------------------------------------------------
237 \SetupKeyvalOptions{
238 family = sht,
239 prefix = sht@,
240 }
241 \newif\ifsht@undergraduate
242 \newif\ifsht@graduate
243 \newif\ifsht@degree@set
244 \sht@degree@setfalse
245 \newcommand\sht@check@degree@set{%
246 \ifsht@degree@set%
247 \sht@error{you can only set degree once}%
248 \else%
249 \sht@degree@settrue%
250 \fi%
251 }
252 \DeclareVoidOption{bachelor}{%
253 \sht@check@degree@set%
254 \sht@undergraduatetrue%
255 \sht@graduatefalse%
256 \def\sht@degree{bachelor}%
257 }
258 \DeclareVoidOption{master}{%
259 \sht@check@degree@set%
260 \sht@undergraduatefalse%
261 \sht@graduatetrue%
262 \def\sht@degree{master}%
263 }
264 \DeclareVoidOption{doctor}{%
265 \sht@check@degree@set%
266 \sht@undergraduatefalse%
267 \sht@graduatetrue%
268 \def\sht@degree{doctor}%
269 }
270 \DeclareBoolOption{anonymous}
271 \DeclareBoolOption{print}
272 \DeclareBoolOption{comfort}
273 \DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{ctexbook}}
274 \ProcessKeyvalOptions*
275 \ifsht@degree@set%
276 \else%
277 \sht@error{you have not set degree (bachelor, master or doctor) yet}%
278 \fi%
279 % ------------------------------------------------------------------------------
280 % Load minimum mandatory packages
281 % ------------------------------------------------------------------------------
282 \ifsht@undergraduate
283 \PassOptionsToClass{zihao = 5}{ctexbook}
284 \PassOptionsToPackage{style = gb7714-2015}{biblatex}
285 \else
286 \PassOptionsToClass{zihao = -4}{ctexbook}
287 \PassOptionsToPackage{style = gb7714-2015ay}{biblatex}
288 \fi
289 \PassOptionsToClass{
290 UTF8,
291 a4paper,
292 twoside,
293 openany,
294 scheme = plain,
295 }{ctexbook}
296 \PassOptionsToPackage{
297 natbib = true,
298 hyperref = manual,
299 backend = biber,
300 gbpub = false,
301 gbcitelocal = chinese,
302 sortcites = false,
303 }{biblatex}
304 \LoadClass{ctexbook}
305 \RequirePackage{expl3}
306 \RequirePackage{xparse}
307 \RequirePackage[hyperref, table]{xcolor}
308 \RequirePackage{geometry}
309 \RequirePackage{calc}
310 \RequirePackage{verbatim}
311 \RequirePackage{etoolbox}
312 \RequirePackage{ifthen}
313 \RequirePackage{graphicx}
314 \RequirePackage{indentfirst}
315 \RequirePackage[normalem]{ulem}
316 \RequirePackage{fancyhdr}
317 \RequirePackage{lastpage}
318 \RequirePackage{tocvsec2}
319 \RequirePackage{letltxmacro}
320 \RequirePackage{fontspec}
321 \RequirePackage{caption}
322 \RequirePackage[shortlabels, inline]{enumitem}
323 \RequirePackage{mathtools}
324 \RequirePackage{amsthm}
325 \RequirePackage[mathbf=sym]{unicode-math}
326 \RequirePackage{biblatex}
327 \AtEndPreamble{
328 \RequirePackage{hyperref}
329 \addbibresource{\sht@bib@resource}
330 \BiblatexManualHyperrefOn
331 \hypersetup{
332 pdfencoding = auto,
333 psdextra = true,
334 bookmarksnumbered = true,
335 pdftitle = {\sht@flat@title},
336 pdfauthor = {\sht@author},
337 }
338 \ifsht@print
339 \hypersetup{
340 hidelinks,
341 colorlinks = false,
342 }
343 \else
344 % `default' color scheme from `fduthesis'
345 \definecolor{fdu@link}{HTML}{990000}
346 \definecolor{fdu@url}{HTML}{0000B2}
347 \definecolor{fdu@cite}{HTML}{007F00}
348 \hypersetup{
349 colorlinks = true,
350 linkcolor = fdu@link,
351 urlcolor = fdu@url,
352 citecolor = fdu@cite,
353 }
354 \fi
355 \urlstyle{tt}
356 }
357 % ==============================================================================
358 % Format Specifications
359 % ==============================================================================
360 % ------------------------------------------------------------------------------
361 % Basic information
362 % ------------------------------------------------------------------------------
363 \def\@title{\sht@title}
364 \def\@author{\sht@author}
365 \def\contentsname{目\hspace{1\ccwd}录}
366 \def\listfigurename{图形列表}
367 \def\listtablename{表格列表}
368 \def\appendixname{附录}
369 \def\indexname{索引}
370 \def\refname{参考文献}
371 \def\bibname{参考文献}
372 \def\tablename{表}
373 \def\figurename{图}
374 \definecolor{ShtRed}{RGB}{146,46,23}
375 \def\school@logo@missing{%
376 校徽文件缺失,请至\href{https://github.com/lirundong/shtthesis/raw/v0.3/%
377 shanghaitech-emblem.pdf}{项目主页}下载!%
378 }
379 % ------------------------------------------------------------------------------
380 % Geometry and layouts
381 % ------------------------------------------------------------------------------
382 \def\binding@width{0.63cm}
383 \def\horizontal@margin{3.17cm}
384 \def\sht@head@logo@height{1.17cm}
385 \ifsht@print
386 \geometry{
387 inner = \horizontal@margin + \binding@width,
388 outer = \horizontal@margin - \binding@width,
389 }
390 \else
391 \geometry{
392 inner = \horizontal@margin,
393 outer = \horizontal@margin,
394 }
395 \fi
396 \setlength{\parskip}{0.5ex plus 0.25ex minus 0.25ex}
397 \setlength{\parindent}{2\ccwd}
398 \ifsht@undergraduate
399 \linespread{1.3}
400 \geometry{
401 includeheadfoot,
402 top = 1.5cm,
403 bottom = 1.75cm,
404 headheight = \sht@head@logo@height,
405 headsep = \baselineskip,
406 footskip = 2.54cm - 1.75cm,
407 }
408 \else
409 \linespread{1.6}
410 \geometry{
411 top = 2.54cm,
412 bottom = 2.54cm,
413 headheight = 12pt,
414 headsep = 17.5pt,
415 footskip = 2.54cm - 1.75cm,
416 }
417 \fi
418 \raggedbottom
419 % ------------------------------------------------------------------------------
420 % Headers and footers
421 % ------------------------------------------------------------------------------
422 \def\sht@flat@title{\renewcommand\\{\space} \sht@title}
423 \def\sht@flat@title@upper@en{%
424 \renewcommand\\{\space}%
425 \MakeUppercase{\sht@title@en}%
426 }
427 \newcommand\sht@head@logo{%
428 \IfFileExists{shanghaitech-emblem.pdf}{%
429 \includegraphics[height=\sht@head@logo@height]{shanghaitech-emblem.pdf}%
430 }{%
431 \fbox{%
432 \begin{minipage}[b][\sht@head@logo@height][c]{0.4\columnwidth}%
433 \zihao{-5}\bfseries\sffamily\color{ShtRed} \school@logo@missing%
434 \end{minipage}%
435 }%
436 }
437 }
438 \pagestyle{fancy}
439 \fancypagestyle{Plain}{}
440 \fancypagestyle{RomanNumbered}{
441 \fancyhf{}
442 \pagenumbering{Roman}
443 \fancyhead[OC]{\footnotesize\nouppercase\leftmark}
444 \fancyhead[EC]{\footnotesize\nouppercase\sht@flat@title}
445 \fancyfoot[C]{\footnotesize\thepage}
446 \renewcommand{\headrulewidth}{0.8pt}
447 \renewcommand{\footrulewidth}{0pt}
448 }
449 \fancypagestyle{LRNumbered}{
450 \fancyhf{}
451 \fancyhead[OC]{\footnotesize\nouppercase\leftmark}
452 \fancyhead[EC]{\footnotesize\nouppercase\sht@flat@title}
453 \fancyfoot[OR]{\footnotesize\thepage}
454 \fancyfoot[EL]{\footnotesize\thepage}
455 \renewcommand{\headrulewidth}{0.8pt}
456 \renewcommand{\footrulewidth}{0pt}
457 }
458 \fancypagestyle{LRNumberedAppendix}{
459 \fancyhf{}
460 \fancyhead[OC]{\footnotesize 附\hspace*{1\ccwd}录}
461 \fancyhead[EC]{\footnotesize\nouppercase\sht@flat@title}
462 \fancyfoot[OR]{\footnotesize\thepage}
463 \fancyfoot[EL]{\footnotesize\thepage}
464 \renewcommand{\headrulewidth}{0.8pt}
465 \renewcommand{\footrulewidth}{0pt}
466 }
467 \fancypagestyle{RomanNumberedWithLogo}{
468 \fancyhf{}
469 \pagenumbering{Roman}
470 \fancyhead[L]{\sht@head@logo}
471 \fancyhead[R]{\zihao{-5}\sffamily\sht@flat@title}
472 \fancyfoot[C]{\footnotesize\thepage}
473 \renewcommand{\headrulewidth}{0.8pt}
474 \renewcommand{\footrulewidth}{0pt}
475 }
476 \fancypagestyle{MNNumberedWithLogo}{
477 \fancyhf{}
478 \fancyhead[L]{\sht@head@logo}
479 \fancyhead[R]{\zihao{-5}\sffamily\sht@flat@title}
480 \fancyfoot[C]{%
481 \footnotesize%
482 第~\thepage~页\hspace*{1\ccwd}共~\pageref*{LastPage}~页%
483 }
484 \renewcommand{\headrulewidth}{0.8pt}
485 \renewcommand{\footrulewidth}{0pt}
486 }
487 \providecommand{\frontmatter}{}
488 \LetLtxMacro{\TmpFrontmatter}{\frontmatter}
489 \renewcommand{\frontmatter}{%
490 \TmpFrontmatter%
491 \ifsht@undergraduate%
492 \pagestyle{RomanNumberedWithLogo}%
493 \else%
494 \pagestyle{RomanNumbered}%
495 \fi%
496 }
497 \providecommand{\mainmatter}{}
498 \LetLtxMacro{\TmpMainmatter}{\mainmatter}
499 \renewcommand{\mainmatter}{%
500 \TmpMainmatter%
501 \renewcommand{\chaptermark}[1]{%
502 \markboth{第~\thechapter~章\hspace{1\ccwd}##1}{}%
503 }%
504 \ifsht@undergraduate%
505 \pagestyle{MNNumberedWithLogo}%
506 \else%
507 \pagestyle{LRNumbered}%
508 \fi%
509 }
510 % ------------------------------------------------------------------------------
511 % Font utilities
512 % ------------------------------------------------------------------------------
513 \newcommand\sht@fontset{\csname g__ctex_fontset_tl\endcsname}
514 \newcommand\currentfontset{\sht@fontset}
515 % ------------------------------------------------------------------------------
516 % English fonts
517 % ------------------------------------------------------------------------------
518 \setmainfont{texgyretermes} [
519 Extension = .otf,
520 UprightFont = *-regular,
521 BoldFont = *-bold,
522 ItalicFont = *-italic,
523 BoldItalicFont = *-bolditalic,
524 Ligatures = TeX,
525 ]
526 \setsansfont{texgyreheros} [
527 Extension = .otf,
528 UprightFont = *-regular,
529 BoldFont = *-bold,
530 ItalicFont = *-italic,
531 BoldItalicFont = *-bolditalic,
532 Ligatures = TeX,
533 ]
534 \setmonofont{texgyrecursor} [
535 Extension = .otf,
536 UprightFont = *-regular,
537 BoldFont = *-bold,
538 ItalicFont = *-italic,
539 BoldItalicFont = *-bolditalic,
540 Ligatures = CommonOff,
541 ]
542 % ------------------------------------------------------------------------------
543 % Chinese fonts
544 % ------------------------------------------------------------------------------
545 \ifthenelse{\equal{\sht@fontset}{windows}}{
546 \def\fake@bold@factor{2.5}
547 \setCJKmainfont{SimSun}[
548 AutoFakeBold = \fake@bold@factor,
549 ItalicFont = KaiTi,
550 ]
551 \setCJKsansfont{SimHei}[
552 AutoFakeBold = \fake@bold@factor,
553 ]
554 \setCJKfamilyfont{zhsong}{SimSun}[
555 AutoFakeBold = \fake@bold@factor,
556 ]
557 \setCJKfamilyfont{zhhei}{SimHei}[
558 AutoFakeBold = \fake@bold@factor,
559 ]
560 \setCJKfamilyfont{zhkai}{KaiTi}[
561 AutoFakeBold = \fake@bold@factor,
562 ]
563 }{
564 \ifthenelse{\equal{\sht@fontset}{mac}}{
565 \setCJKmainfont{Songti SC}[
566 UprightFont = * Regular,
567 BoldFont = * Bold,
568 ItalicFont = Kaiti SC Regular,
569 BoldItalicFont = Kaiti SC Bold,
570 ]
571 \setCJKsansfont{Heiti SC}[
572 UprightFont = * Light,
573 BoldFont = * Medium,
574 ]
575 \setCJKfamilyfont{zhsong}{Songti SC}[
576 UprightFont = * Regular,
577 BoldFont = * Bold,
578 ]
579 \setCJKfamilyfont{zhhei}{Heiti SC}[
580 UprightFont = * Light,
581 BoldFont = * Medium,
582 ]
583 \setCJKfamilyfont{zhkai}{Kaiti SC}[
584 UprightFont = * Regular,
585 BoldFont = * Bold,
586 ]
587 }{
588 \IfFontExistsTF{Noto Serif CJK SC}{
589 \def\unix@songti{Noto Serif CJK SC}
590 }{
591 \IfFontExistsTF{Source Han Serif SC}{
592 \def\unix@songti{Source Han Serif SC}
593 }{
594 \def\unix@songti{FandolSong}
595 }
596 }
597 \IfFontExistsTF{Noto Sans CJK SC}{
598 \def\unix@heiti{Noto Sans CJK SC}
599 }{
600 \IfFontExistsTF{Source Han Sans SC}{
601 \def\unix@heiti{Source Han Sans SC}
602 }{
603 \def\unix@heiti{FandolHei}
604 }
605 }
606 \edef\unix@heiti@medium@impl{\unix@heiti\space Medium}
607 \edef\unix@heiti@bold@impl{\unix@heiti\space Bold}
608 \IfFontExistsTF{\unix@heiti@medium@impl}{
609 \def\unix@heiti@bold{\unix@heiti@medium@impl}
610 }{
611 \def\unix@heiti@bold{\unix@heiti@bold@impl}
612 }
613 \IfFontExistsTF{FZKai-Z03}{
614 \def\unix@kaiti{FZKai-Z03}
615 }{
616 \def\unix@kaiti{FandolKai}
617 }
618 \IfFontExistsTF{FZFangSong-Z02}{
619 \def\unix@fangsong{FZFangSong-Z02}
620 }{
621 \def\unix@fangsong{FandolFang}
622 }
623 \ifluatex
624 \setCJKmainfont{\unix@songti}[ItalicFont=\unix@kaiti]
625 \setCJKsansfont{\unix@heiti}[BoldFont=\unix@heiti@bold]
626 \setCJKmonofont{\unix@fangsong}
627 \setCJKfamilyfont{zhsong}{\unix@songti}
628 \setCJKfamilyfont{zhhei}{\unix@heiti}[BoldFont=\unix@heiti@bold]
629 \setCJKfamilyfont{zhkai}{\unix@kaiti}
630 \setCJKfamilyfont{zhfs}{\unix@fangsong}
631 \else
632 \ifthenelse{\equal{\unix@songti}{FandolSong}}{
633 \setCJKmainfont{FandolSong}[
634 Extension = .otf,
635 UprightFont = *-Regular,
636 BoldFont = *-Bold,
637 ItalicFont = FandolKai-Regular,
638 ]
639 \setCJKfamilyfont{zhsong}{FandolSong}[
640 Extension = .otf,
641 UprightFont = *-Regular,
642 BoldFont = *-Bold,
643 ]
644 }{
645 \ifthenelse{\equal{\unix@kaiti}{FandolKai}}{
646 \setCJKmainfont{\unix@songti}[
647 ItalicFont = FandolKai-Regular,
648 ItalicFeatures = {Extension = .otf},
649 ]
650 }{
651 \setCJKmainfont{\unix@songti}[ItalicFont=\unix@kaiti]
652 }
653 \setCJKfamilyfont{zhsong}{\unix@songti}
654 }
655 \ifthenelse{\equal{\unix@heiti}{FandolHei}}{
656 \setCJKsansfont{FandolHei}[
657 Extension = .otf,
658 UprightFont = *-Regular,
659 BoldFont = *-Bold,
660 ]
661 \setCJKfamilyfont{zhhei}{FandolHei}[
662 Extension = .otf,
663 UprightFont = *-Regular,
664 BoldFont = *-Bold,
665 ]
666 }{
667 \setCJKsansfont{\unix@heiti}[BoldFont=\unix@heiti@bold]
668 \setCJKfamilyfont{zhhei}{\unix@heiti}[BoldFont=\unix@heiti@bold]
669 }
670 \ifthenelse{\equal{\unix@kaiti}{FandolKai}}{
671 \setCJKfamilyfont{zhkai}{FandolKai}[
672 Extension = .otf,
673 UprightFont = *-Regular,
674 ]
675 }{
676 \setCJKfamilyfont{zhkai}{\unix@kaiti}
677 }
678 \ifthenelse{\equal{\unix@fangsong}{FandolFang}}{
679 \setCJKfamilyfont{zhfs}{FandolFang}[
680 Extension = .otf,
681 UprightFont = *-Regular,
682 ]
683 \setCJKmonofont{FandolFang}[
684 Extension = .otf,
685 UprightFont = *-Regular,
686 ]
687 }{
688 \setCJKmonofont{\unix@fangsong}
689 \setCJKfamilyfont{zhfs}{\unix@fangsong}
690 }
691 \fi
692 \providecommand{\songti}{\CJKfamily{zhsong}}
693 \providecommand{\heiti}{\CJKfamily{zhhei}}
694 \providecommand{\kaishu}{\CJKfamily{zhkai}}
695 \providecommand{\fangsong}{\CJKfamily{zhfs}}
696 }
697 }
698 % ------------------------------------------------------------------------------
699 % Math content specifications
700 %
701 % Following setup is adapted from `thuthesis'
702 % ------------------------------------------------------------------------------
703 \unimathsetup{
704 math-style = ISO,
705 bold-style = ISO,
706 nabla = upright,
707 partial = upright,
708 }
709 \protected\def\le{\leqslant}
710 \protected\def\ge{\geqslant}
711 \AtBeginDocument{%
712 \renewcommand\leq{\leqslant}%
713 \renewcommand\geq{\geqslant}%
714 }
715 \removenolimits{%
716 \int\iint\iiint\iiiint\oint\oiint\oiiint
717 \intclockwise\varointclockwise\ointctrclockwise\sumint
718 \intbar\intBar\fint\cirfnint\awint\rppolint
719 \scpolint\npolint\pointint\sqint\intlarhk\intx
720 \intcap\intcup\upint\lowint
721 }
722 \AtBeginDocument{%
723 \renewcommand{\Re}{\operatorname{Re}}%
724 \renewcommand{\Im}{\operatorname{Im}}%
725 }
726 \newcommand\bm{\symbf}
727 \renewcommand\boldsymbol{\symbf}
728 \newcommand\square{\mdlgwhtsquare}
729 \AtBeginDocument{%
730 \renewcommand\checkmark{\ensuremath{✓}}%
731 }
732 \allowdisplaybreaks[4]
733 \ifsht@graduate
734 \newtagform{dots}{\ldots\ (}{)}
735 \usetagform{dots}
736 \renewcommand{\eqref}[1]{\textup{(\ref{#1})}}
737 \fi
738 % ------------------------------------------------------------------------------
739 % Math fonts
740 % ------------------------------------------------------------------------------
741 \IfFontExistsTF{XITSMath-Regular.otf}{
742 \def\sht@math@font{XITSMath-Regular.otf}
743 }{
744 \def\sht@math@font{xits-math.otf}
745 }
746 \setmathfont{\sht@math@font}[
747 StylisticSet = 8, % upright integral variants, please refer to stix2-otf doc
748 ]
749 % please refer to "Caligraphic vs. Script variants" section of unicode-math doc
750 \setmathfont{\sht@math@font}[
751 range = {cal, bfcal},
752 StylisticSet = 1,
753 ]
754 \setmathfont{\sht@math@font}[
755 range = {scr, bfscr},
756 StylisticSet = 2,
757 ]
758 % ------------------------------------------------------------------------------
759 % Math environmrnts
760 % ------------------------------------------------------------------------------
761 \theoremstyle{plain}
762 \newtheorem{theorem}{定理}[chapter]
763 \newtheorem{lemma}{引理}[chapter]
764 \newtheorem{corollary}{推论}[theorem]
765 \newtheorem{proposition}{命题}[chapter]
766 \newtheorem{conjecture}{猜想}[chapter]
767 \theoremstyle{definition}
768 \newtheorem{definition}{定义}[chapter]
769 \newtheorem{axiom}{公理}[chapter]
770 \newtheorem{example}{例}[chapter]
771 \newtheorem{exercise}{练习}[chapter]
772 \newtheorem{problem}{问题}[chapter]
773 \theoremstyle{remark}
774 \newtheorem{remark}{注}[chapter]
775 \renewcommand*{\proofname}{证明}
776 \expandafter\patchcmd\csname\string\proof\endcsname{\@addpunct{.}}%
777 {\@addpunct{\emph{:}}}{}{}
778 % ------------------------------------------------------------------------------
779 % Utility functions for ToC and bookmarks
780 % ------------------------------------------------------------------------------
781 \newcommand{\artxmaincnt}{%
782 \ifcsname c@chapter\endcsname%
783 chapter%
784 \else%
785 section%
786 \fi%
787 }
788 \long\def\artxaux#1{}
789 \newcommand{\intotocnostar}[3]{%
790 % [<\chapter|...>,<*>,<title>]
791 #1#2{%
792 \phantomsection%
793 \addcontentsline{toc}{\expandafter\artxaux\string#1}{#3}%
794 #3%
795 }
796 \markboth{\MakeUppercase{#3}}{}%
797 }
798 \newcommand{\intotocstar}[3][\artxmaincnt]{%
799 % [<chapter|...>,<extra commands>,<title>]
800 #2%
801 \phantomsection%
802 \addcontentsline{toc}{#1}{#3}%
803 \markboth{\MakeUppercase{#3}}{}%
804 }
805 \newcommand{\intotoc}{\@ifstar{\intotocstar}{\intotocnostar}}
806 \newcommand{\intobmknostar}[4][0]{%
807 % [<level>,<\chapter|...>,<*>,<title>]
808 #2#3{%
809 \phantomsection%
810 \Hy@writebookmark%
811 {}%
812 {#4}%
813 {\@currentHref}%
814 {#1}%
815 {toc}%
816 #4%
817 }%
818 \markboth{\MakeUppercase{#4}}{}%
819 }
820 \newcommand{\intobmkstar}[3][0]{%
821 % [<level>,<extra commands>,<title>]
822 #2%
823 \phantomsection%
824 \Hy@writebookmark%
825 {}%
826 {#3}%
827 {\@currentHref}%
828 {#1}%
829 {toc}%
830 \markboth{\MakeUppercase{#3}}{}%
831 }
832 \newcommand{\intobmk}{\@ifstar{\intobmkstar}{\intobmknostar}}
833 % \cleardoublepage only works on graduate or undergraduate print mode
834 \LetLtxMacro{\OriginCleardoublepage}{\cleardoublepage}
835 \renewcommand{\cleardoublepage}{%
836 \ifthenelse{\boolean{sht@undergraduate} \AND \NOT\boolean{sht@print}}{%
837 \relax\clearpage%
838 }{%
839 \OriginCleardoublepage%
840 }%
841 }
842 % ------------------------------------------------------------------------------
843 % Table of contents, figures and tables
844 % ------------------------------------------------------------------------------
845 \DeclareCaptionFont{wuhaocuti}{\zihao{5}\bfseries}
846 \captionsetup{
847 format = plain,
848 hangindent = 2.0em,
849 labelsep = quad,
850 font = {wuhaocuti},
851 }
852 \ifsht@undergraduate
853 \captionsetup{
854 skip = 6pt,
855 }
856 \def\sht@toc@chapter@fmt{\zihao{5}\rmfamily}
857 \def\sht@toc@section@fmt{\zihao{5}\rmfamily}
858 \else
859 \captionsetup{
860 skip = 8pt,
861 }
862 \def\sht@toc@chapter@fmt{\zihao{4}\heiti}
863 \def\sht@toc@section@fmt{\zihao{-4}\heiti}
864 \fi
865 \def\@dotsep{1.5mu}
866 \def\@pnumwidth{2em}
867 \def\@tocrmarg{2em}
868 \def\@chaptervspace{1ex}
869 % [<level>,<indent>,<numwidth>,<title>,<page>]
870 \renewcommand*{\@dottedtocline}[5]{
871 \ifnum #1>\c@tocdepth \else
872 \vskip \z@ \@plus.2\p@
873 {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
874 \parindent #2\relax\@afterindenttrue
875 \interlinepenalty\@M
876 \leavevmode \sht@toc@section@fmt
877 \@tempdima #3\relax
878 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
879 {#4}\nobreak
880 \leaders\hbox{$\m@th\mkern \@dotsep \cdot\mkern \@dotsep$}\hfill
881 \nobreak
882 \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}%
883 \par\penalty\@highpenalty}%
884 \fi
885 }
886 % [<title>,<page>]
887 \renewcommand*{\l@part}[2]{
888 \ifnum \c@tocdepth >-2\relax
889 \addpenalty{-\@highpenalty}%
890 \addvspace{2.25em \@plus\p@}%
891 \setlength\@tempdima{3em}%
892 \begingroup
893 \parindent \z@ \rightskip \@pnumwidth
894 \parfillskip -\@pnumwidth
895 {\leavevmode
896 \sht@toc@chapter@fmt #1
897 \leaders\hbox{$\m@th\mkern \@dotsep \cdot\mkern \@dotsep$}
898 \hfil \hb@xt@\@pnumwidth{\hss #2}}\par
899 \nobreak
900 \global\@nobreaktrue
901 \everypar{\global\@nobreakfalse\everypar{}}%
902 \endgroup
903 \fi
904 }
905 % [<title>,<page>]
906 \renewcommand*{\l@chapter}[2]{
907 \ifnum \c@tocdepth >\m@ne
908 \addpenalty{-\@highpenalty}%
909 \ifsht@undergraduate%
910 \else%
911 \vskip \@chaptervspace \@plus\p@%
912 \fi%
913 \setlength\@tempdima{1.5em}%
914 \begingroup
915 \parindent \z@ \rightskip \@pnumwidth
916 \parfillskip -\@pnumwidth
917 \leavevmode \sht@toc@chapter@fmt
918 \advance\leftskip\@tempdima
919 \hskip -\leftskip
920 #1\nobreak
921 \leaders\hbox{$\m@th\mkern \@dotsep \cdot\mkern \@dotsep$}
922 \hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
923 \penalty\@highpenalty
924 \endgroup
925 \fi
926 }
927 \renewcommand*\l@section{\@dottedtocline{1}{1em}{1.8em}}
928 \renewcommand*\l@subsection{\@dottedtocline{2}{2em}{2.8em}}
929 \renewcommand*\l@subsubsection{\@dottedtocline{3}{3em}{3.8em}}
930 \renewcommand*\l@paragraph{\@dottedtocline{4}{4em}{4.8em}}
931 \renewcommand*\l@subparagraph{\@dottedtocline{5}{5em}{5.8em}}
932 \renewcommand*\l@figure{\@dottedtocline{1}{1em}{1.8em}}
933 \renewcommand*\l@table{\@dottedtocline{1}{1em}{1.8em}}
934 \setcounter{tocdepth}{2}
935 \setcounter{secnumdepth}{3}
936 \newcommand{\makeindices}{%
937 \begingroup%
938 \linespread{1.2}%
939 \hypersetup{linkcolor=black}%
940 \intobmk*{\cleardoublepage}{\contentsname}%
941 \tableofcontents%
942 \ifsht@graduate%
943 \intobmk*{\cleardoublepage}{\listfigurename}%
944 \listoffigures%
945 \intobmk*{\cleardoublepage}{\listtablename}%
946 \listoftables%
947 \fi%
948 \endgroup%
949 }
950 % ------------------------------------------------------------------------------
951 % Content specifications
952 % ------------------------------------------------------------------------------
953 \ctexset {
954 chapter = {
955 format = \bfseries\heiti\zihao{4}\linespread{1.0}\centering,
956 nameformat = {},
957 numberformat = \rmfamily,
958 titleformat = {},
959 name = {第, 章},
960 number = \arabic{chapter},
961 aftername = \hspace{0.75\ccwd},
962 beforeskip = {7pt},
963 afterskip = {18pt},
964 pagestyle = Plain,
965 },
966 section = {
967 format = \heiti\normalsize\linespread{1.0}\raggedright,
968 nameformat = {},
969 numberformat = \rmfamily,
970 titleformat = {},
971 aftername = \hspace{0.75\ccwd},
972 beforeskip = {24pt},
973 afterskip = {6pt},
974 },
975 subsection = {
976 format = \heiti\normalsize\linespread{1.0}\raggedright,
977 nameformat = {},
978 numberformat = \rmfamily,
979 titleformat = {},
980 aftername = \hspace{0.75\ccwd},
981 beforeskip = {12pt},
982 afterskip = {6pt},
983 },
984 subsubsection = {
985 format = \heiti\normalsize\linespread{1.0}\raggedright,
986 nameformat = {},
987 numberformat = \rmfamily,
988 titleformat = {},
989 aftername = \hspace{0.75\ccwd},
990 beforeskip = {12pt},
991 afterskip = {6pt},
992 },
993 paragraph = {
994 indent = 2\ccwd,
995 beforeskip = {0pt},
996 afterskip = {0.75\ccwd},
997 },
998 punct = quanjiao,
999 space = auto,
1000 autoindent = true,
1001 }
1002 \ifsht@undergraduate
1003 \newlength{\sht@section@indent}
1004 \ifsht@comfort
1005 \def\sht@chapter@fmt{\bfseries\sffamily\zihao{4}\linespread{1.0}\centering}
1006 \def\sht@section@fmt{\sffamily\zihao{-4}\linespread{1.0}\raggedright}
1007 \def\sht@subsection@fmt{\sffamily\zihao{5}\linespread{1.0}\raggedright}
1008 \setlength{\sht@section@indent}{0pt}
1009 \else
1010 \def\sht@chapter@fmt{\bfseries\sffamily\zihao{3}\linespread{1.0}\centering}
1011 \def\sht@section@fmt{\sffamily\zihao{4}\linespread{1.0}\raggedright}
1012 \def\sht@subsection@fmt{\rmfamily\zihao{-4}\linespread{1.0}\raggedright}
1013 \setlength{\sht@section@indent}{2\ccwd}
1014 \fi
1015 \ctexset{
1016 chapter = {
1017 format = \sht@chapter@fmt,
1018 number = \chinese{chapter},
1019 numberformat = {},
1020 },
1021 section = {
1022 format = \sht@section@fmt,
1023 numberformat = {},
1024 indent = \sht@section@indent,
1025 beforeskip = {18pt},
1026 },
1027 subsection = {
1028 format = \sht@subsection@fmt,
1029 numberformat = {},
1030 indent = \sht@section@indent,
1031 },
1032 subsubsection = {
1033 format = \sht@subsection@fmt,
1034 numberformat = {},
1035 indent = \sht@section@indent,
1036 }
1037 }
1038 \fi
1039 % ------------------------------------------------------------------------------
1040 % List environments
1041 % ------------------------------------------------------------------------------
1042 \newcommand{\textbf@with@colon}[1]{\textbf{#1:}}
1043 \setlist{
1044 nosep,
1045 labelindent = 2\ccwd,
1046 labelwidth = *,
1047 labelsep = 0.5\ccwd,
1048 leftmargin = 0em,
1049 itemindent = *,
1050 listparindent = 2\ccwd,
1051 }
1052 \setlist[description]{
1053 labelsep = 0em,
1054 format = \normalfont\textbf@with@colon,
1055 }
1056 % ------------------------------------------------------------------------------
1057 % Quotation environments
1058 % ------------------------------------------------------------------------------
1059 \ExplSyntaxOn
1060 \ctex_patch_cmd:Nnn \quotation { 1.5em } { 2 \ccwd }
1061 \ExplSyntaxOff
1062 \BeforeBeginEnvironment{quotation}{%
1063 \begingroup%
1064 \setlength\leftmargini{2\ccwd}%
1065 }
1066 \AtBeginEnvironment{quotation}{%
1067 \itshape%
1068 }
1069 \AfterEndEnvironment{quotation}{%
1070 \endgroup%
1071 }
1072 % ==============================================================================
1073 % Cover Generation
1074 % ==============================================================================
1075 \def\ubox@right@shift{0.5\ccwd}
1076 \def\content@left@shift{2.75\ccwd}
1077 \def\cover@tab@entry@width{350pt}
1078 \def\cover@tab@last@entry@width{\cover@tab@entry@width - 2\ccwd - 0.5\ccwd}
1079 \def\cover@tab@uline@thick{1.2pt}
1080 \ExplSyntaxOn
1081 \ProvideDocumentCommand{\shifted@uline}{%
1082 O{\cover@tab@uline@thick} %
1083 O{\ubox@right@shift} %
1084 m}{%
1085 \def\ULthickness{#1}%
1086 \setlength{\ULdepth}{0.3em}%
1087 \hspace*{#2}%
1088 \uline{#3}%
1089 }
1090 \ProvideDocumentCommand{\shifted@box}{%
1091 O{\cover@tab@entry@width} %
1092 O{\content@left@shift} %
1093 m}{%
1094 \makebox[#1][c]{\hspace*{-#2} #3 }%
1095 }
1096 \ProvideDocumentCommand{\sht@lines@to@tab}{%
1097 O{\cover@tab@uline@thick} %
1098 O{\cover@tab@entry@width} %
1099 O{\content@left@shift} %
1100 m}{%
1101 % convert lines into table lines, adapted from `ucasthesis'
1102 \seq_set_split:NnV \l_tmpa_seq {\\} {#4}
1103 \clist_set_from_seq:NN \l_tmpa_clist \l_tmpa_seq
1104 \clist_clear:N \l_tmpb_clist
1105 \clist_map_inline:Nn \l_tmpa_clist
1106 {%
1107 \clist_put_right:Nn \l_tmpb_clist
1108 { \shifted@uline[#1]{\shifted@box[#2][#3]{##1}} }
1109 }
1110 \clist_use:Nn \l_tmpb_clist { \\ & }
1111 }
1112 \ExplSyntaxOff
1113 \newcommand\sht@schoollogo{%
1114 \IfFileExists{shanghaitech-emblem.pdf}{%
1115 \includegraphics[width=10.48cm]{shanghaitech-emblem.pdf}%
1116 }{%
1117 \begin{center}%
1118 \fbox{%
1119 \begin{minipage}[t][2.79cm][c]{10.48cm}%
1120 \centering\bfseries\color{ShtRed} \school@logo@missing%
1121 \end{minipage}%
1122 }%
1123 \end{center}%
1124 }%
1125 }
1126 \newcommand\sht@schoollogo@undergraduate{%
1127 \noindent%
1128 \IfFileExists{shanghaitech-emblem.pdf}{%
1129 \includegraphics[width=5.39cm]{shanghaitech-emblem.pdf}%
1130 }{%
1131 \fbox{%
1132 \begin{minipage}[t][1.45cm][c]{0.75\columnwidth}%
1133 \bfseries\color{ShtRed} \school@logo@missing%
1134 \end{minipage}%
1135 }%
1136 }%
1137 }
1138 \renewcommand{\maketitle}{%
1139 \ifsht@undergraduate
1140 \sht@maketitle@undergraduate
1141 \sht@maketitle@undergraduate@en
1142 \else
1143 \ifthenelse{\equal{\sht@degree}{doctor}}{
1144 \sht@maketitle@graduate{博士}
1145 \sht@maketitle@graduate@en{dissertation}
1146 }{
1147 \ifthenelse{\equal{\sht@degree}{master}}{
1148 \sht@maketitle@graduate{硕士}
1149 \sht@maketitle@graduate@en{thesis}
1150 }{
1151 \sht@error{Degree type `\sht@degree' is not supported yet}
1152 }
1153 }
1154 \fi
1155 \ifthenelse{\not \boolean{sht@anonymous}}{%
1156 \ifsht@undergraduate%
1157 \makedeclarations@undergraduate%
1158 \else%
1159 \makedeclarations%
1160 \fi
1161 }{}
1162 }
1163 % ------------------------------------------------------------------------------
1164 % PhD/Master covers
1165 % ------------------------------------------------------------------------------
1166 \newcommand{\sht@maketitle@graduate}[1]{%
1167 \intobmk*{\cleardoublepage}{封面}
1168 \thispagestyle{empty}
1169 \begin{center}
1170 \linespread{1.6}\zihao{4}\bfseries
1171 \hfill{}
1172 \ifdefempty{\sht@secret@level}{}{%
1173 密级:%
1174 \shifted@uline[1pt][0pt]{%
1175 \shifted@box[50pt][0pt]{%
1176 \zihao{5} \sht@secret@level%
1177 }%
1178 }%
1179 }
1180
1181 \vspace*{\stretch{4}}
1182
1183 \sht@schoollogo
1184
1185 \vspace*{\stretch{2}}
1186
1187 {\zihao{1}\heiti #1学位论文}
1188
1189 \vspace*{\stretch{3}}
1190
1191 {\zihao{-3}\heiti \shifted@uline[1.5pt][0pt]{\sht@title}}
1192
1193 \vspace*{\stretch{3}}
1194
1195 {
1196 \songti
1197 \def\tabcolsep{1pt}
1198 \def\arraystretch{1.3}
1199 \begin{tabular}{llc}
1200 作者姓名:&
1201 \multicolumn{2}{c}{\shifted@uline{\shifted@box{%
1202 \ifsht@anonymous%
1203 \sht@anonymous@str%
1204 \else%
1205 \sht@author%
1206 \fi%
1207 }}} \\
1208 指导教师:&
1209 \multicolumn{2}{c}{\shifted@uline{\shifted@box{%
1210 \ifsht@anonymous%
1211 \sht@anonymous@str%
1212 \else%
1213 \sht@supervisor%
1214 \fi%
1215 }}} \\
1216 \ifdefempty{\sht@supervisor@institution}{}{ &
1217 \multicolumn{2}{c}{\shifted@uline{%
1218 \shifted@box{\sht@supervisor@institution}}} \\
1219 }
1220 学位类别:&
1221 \multicolumn{2}{c}{\shifted@uline{\shifted@box{\sht@degree@name}}} \\
1222 一级学科:&
1223 \multicolumn{2}{c}{\shifted@uline{%
1224 \shifted@box{\sht@discipline@level@i}}} \\
1225 \multicolumn{2}{l}{学校/学院名称:} &
1226 \shifted@uline{\shifted@box[\cover@tab@last@entry@width]{%
1227 \sht@institution}} \\
1228 \end{tabular}
1229 }
1230
1231 \vspace*{\stretch{4}}
1232
1233 \sht@date
1234
1235 \vspace{\stretch{4}}
1236 \end{center}
1237 \clearpage
1238 \thispagestyle{empty}
1239 \cleardoublepage
1240 }
1241 \newcommand{\sht@maketitle@graduate@en}[1]{
1242 \intobmk*{\cleardoublepage}{Cover}
1243 \thispagestyle{empty}
1244 \begin{center}
1245 \linespread{1.6}
1246 \zihao{4}\bfseries
1247
1248 \vspace*{50pt}
1249
1250 {\zihao{-3}\bfseries \shifted@uline[1.5pt][0pt]{\sht@title@en}}
1251
1252 \vspace*{\stretch{3}}
1253
1254 {
1255 A~#1~submitted~to\\
1256 ShanghaiTech~University\\
1257 in~partial~fulfillment~of~the~requirement\\
1258 for~the~degree~of\\
1259 \ifthenelse{\equal{\sht@degree}{doctor}}{
1260 Doctor~of~Philosophy\\
1261 }{
1262 \sht@degree@name@en\\
1263 }
1264 in~\sht@discipline@level@i@en
1265
1266 By
1267
1268 \ifsht@anonymous%
1269 \sht@anonymous@str%
1270 \else%
1271 \sht@author@en%
1272 \fi%
1273
1274 Supervisor:~%
1275 \ifsht@anonymous%
1276 \sht@anonymous@str%
1277 \else%
1278 \sht@supervisor@en%
1279 \fi%
1280 }
1281
1282 \vspace*{\stretch{3}}
1283
1284 {\sht@institution@en}
1285
1286 \vspace*{\stretch{1}}
1287
1288 {\sht@date@en}
1289
1290 \vspace{\stretch{3}}
1291 \end{center}
1292 \clearpage
1293 \thispagestyle{empty}
1294 \cleardoublepage
1295 }
1296 % ------------------------------------------------------------------------------
1297 % Bachelor covers
1298 % ------------------------------------------------------------------------------
1299 \def\cover@tab@entry@width@undergraduate{300pt}
1300 \def\cover@tab@uline@thick@undergraduate{1pt}
1301 \def\content@left@shift@en{2.5\ccwd}
1302 \newcommand{\sht@maketitle@undergraduate}{%
1303 \intobmk*{\cleardoublepage}{封面}
1304 \thispagestyle{empty}
1305 \sht@schoollogo@undergraduate
1306 \begin{center}
1307 \linespread{1.6}
1308
1309 \vspace*{\stretch{20}}
1310
1311 {\zihao{2}\bfseries 本科毕业论文(设计)}
1312
1313 \vspace*{\stretch{54}}
1314
1315 {
1316 \zihao{4}
1317 \def\tabcolsep{1pt}
1318 \def\arraystretch{1.3}
1319 \begin{tabular}{cc}
1320 题\hspace{2\ccwd}目:&
1321 \sht@lines@to@tab[\cover@tab@uline@thick@undergraduate]%
1322 [\cover@tab@entry@width@undergraduate]{\sht@title} \\
1323 学生姓名:&
1324 \shifted@uline[\cover@tab@uline@thick@undergraduate]%
1325 {\shifted@box[\cover@tab@entry@width@undergraduate]{%
1326 \sht@author}} \\
1327 学\hspace{2\ccwd}号:&
1328 \shifted@uline[\cover@tab@uline@thick@undergraduate]%
1329 {\shifted@box[\cover@tab@entry@width@undergraduate]{%
1330 \sht@author@id}} \\
1331 入学年份:&
1332 \shifted@uline[\cover@tab@uline@thick@undergraduate]%
1333 {\shifted@box[\cover@tab@entry@width@undergraduate]{%
1334 \sht@entrance@year}} \\
1335 所在学院:&
1336 \shifted@uline[\cover@tab@uline@thick@undergraduate]%
1337 {\shifted@box[\cover@tab@entry@width@undergraduate]{%
1338 \sht@institution}} \\
1339 攻读专业:&
1340 \shifted@uline[\cover@tab@uline@thick@undergraduate]%
1341 {\shifted@box[\cover@tab@entry@width@undergraduate]{%
1342 \sht@discipline}} \\
1343 指导教师:&
1344 \shifted@uline[\cover@tab@uline@thick@undergraduate]%
1345 {\shifted@box[\cover@tab@entry@width@undergraduate]{%
1346 \sht@supervisor}} \\
1347 \end{tabular}
1348 }
1349
1350 \vspace*{\stretch{70}}
1351
1352 {
1353 \zihao{-4}
1354 上海科技大学
1355 \par\sht@date
1356 }
1357
1358 \vspace{\stretch{11}}
1359 \end{center}
1360 \clearpage
1361 \thispagestyle{empty}
1362 \cleardoublepage
1363 }
1364 \newcommand{\sht@maketitle@undergraduate@en}{%
1365 \intobmk*{\cleardoublepage}{Cover}
1366 \thispagestyle{empty}
1367 \sht@schoollogo@undergraduate
1368 \begin{center}
1369 \linespread{1.6}
1370
1371 \vspace*{\stretch{20}}
1372
1373 {\zihao{2}\bfseries\sffamily THESIS}
1374
1375 \vspace*{\stretch{54}}
1376
1377 {
1378 \zihao{4}
1379 \def\tabcolsep{1pt}
1380 \def\arraystretch{1.3}
1381 \begin{tabular}{lc}
1382 Subject: &
1383 \sht@lines@to@tab[\cover@tab@uline@thick@undergraduate]%
1384 [\cover@tab@entry@width@undergraduate][\content@left@shift@en]{%
1385 \sht@title@en} \\
1386 Student Name: &
1387 \shifted@uline[\cover@tab@uline@thick@undergraduate]%
1388 {\shifted@box[\cover@tab@entry@width@undergraduate]%
1389 [\content@left@shift@en]{\sht@author@en}} \\
1390 Student ID: &
1391 \shifted@uline[\cover@tab@uline@thick@undergraduate]%
1392 {\shifted@box[\cover@tab@entry@width@undergraduate]%
1393 [\content@left@shift@en]{\sht@author@id}} \\
1394 Year of Entrance: &
1395 \shifted@uline[\cover@tab@uline@thick@undergraduate]%
1396 {\shifted@box[\cover@tab@entry@width@undergraduate]%
1397 [\content@left@shift@en]{\sht@entrance@year}} \\
1398 School: &
1399 \shifted@uline[\cover@tab@uline@thick@undergraduate]%
1400 {\shifted@box[\cover@tab@entry@width@undergraduate]%
1401 [\content@left@shift@en]{\sht@institution@en}} \\
1402 Major: &
1403 \shifted@uline[\cover@tab@uline@thick@undergraduate]%
1404 {\shifted@box[\cover@tab@entry@width@undergraduate]%
1405 [\content@left@shift@en]{\sht@discipline@en}} \\
1406 Advisor: &
1407 \shifted@uline[\cover@tab@uline@thick@undergraduate]%
1408 {\shifted@box[\cover@tab@entry@width@undergraduate]%
1409 [\content@left@shift@en]{\sht@supervisor@en}} \\
1410 \end{tabular}
1411 }
1412
1413 \vspace*{\stretch{70}}
1414
1415 {
1416 \zihao{-4}
1417 ShanghaiTech University
1418 \par Date:~\sht@date@en
1419 }
1420
1421 \vspace{\stretch{11}}
1422 \end{center}
1423 \clearpage
1424 \thispagestyle{empty}
1425 \cleardoublepage
1426 }
1427 % ------------------------------------------------------------------------------
1428 % Declarations
1429 % ------------------------------------------------------------------------------
1430 \newcommand{\makedeclarations}{%
1431 \intobmk*{\cleardoublepage}{声明}
1432 \thispagestyle{empty}
1433 {
1434 \linespread{1.6}\zihao{-4}
1435
1436 \vspace*{2ex}
1437
1438 \begin{center}
1439 \zihao{4}\bfseries\sffamily 上海科技大学\\研究生学位论文原创性声明
1440 \end{center}
1441
1442 本人郑重声明:所呈交的学位论文是本人在导师的指导下独立进行研究工作所取得的成果。%
1443 尽我所知,除文中已经注明引用的内容外,本论文不包含任何其他个人或集体已经发表或撰写%
1444 过的研究成果。对论文所涉及的研究工作做出贡献的其他个人和集体,均已在文中以明确方式%
1445 标明或致谢。
1446
1447 \vspace*{3ex}
1448
1449 {\hfill{}作者签名:\hspace*{14em}}
1450
1451 {\hfill{}日\hspace*{2\ccwd}期:\hspace*{14em}}
1452
1453 \vspace*{6ex}
1454
1455 \begin{center}
1456 \zihao{4}\bfseries\sffamily 上海科技大学\\学位论文授权使用声明
1457 \end{center}
1458
1459 本人完全了解并同意遵守上海科技大学有关保存和使用学位论文的规定,即上海科技大学有权%
1460 保留送交学位论文的副本,允许该论文被查阅,可以按照学术研究公开原则和保护知识产权%
1461 的原则公布该论文的全部或部分内容,可以采用影印、缩印或其他复制手段保存、汇编本%
1462 学位论文。
1463
1464 涉密及延迟公开的学位论文在解密或延迟期后适用本声明。
1465
1466 \vspace*{3ex}
1467
1468 {\hfill{}作者签名:\hspace*{10em}导师签名:\hspace*{9em}}
1469
1470 \hfill{}日\hspace*{2\ccwd}期:%
1471 \hspace*{10em}日\hspace*{2\ccwd}期:\hspace*{9em}%
1472
1473 \vspace{3ex}
1474 }
1475 \clearpage
1476 \thispagestyle{empty}
1477 \cleardoublepage
1478 }
1479 \newcommand{\makedeclarations@undergraduate}{%
1480 \intobmk*{\cleardoublepage}{声明}
1481 % P1: 学术诚信声明
1482 \thispagestyle{empty}
1483 {
1484 \linespread{1.6}\zihao{4}
1485
1486 \vspace*{\stretch{1}}
1487
1488 \begin{center}
1489 \zihao{-2}\bfseries\sffamily 上海科技大学\\毕业论文(设计)学术诚信声明
1490 \end{center}
1491
1492 \vspace*{\stretch{1}}
1493
1494 本人郑重声明:所呈交的毕业论文(设计),是本人在导师的指导下,独立进行研究工作%
1495 所取得的成果。除文中已经注明引用的内容外,本论文不包含任何其他个人或集体已经发表%
1496 或撰写过的作品成果。对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式%
1497 标明。本人完全意识到本声明的法律结果由本人承担。
1498
1499 \vspace*{\stretch{3}}
1500
1501 \hfill{}作者签名:\hspace*{9.5\ccwd}
1502
1503 \vspace*{\stretch{1}}
1504
1505 \hfill{}日\hspace*{2\ccwd}期:%
1506 \hspace*{2.5\ccwd}年%
1507 \hspace*{1.5\ccwd}月%
1508 \hspace*{1.5\ccwd}日%
1509 \hspace*{1\ccwd}
1510
1511 \vspace{\stretch{6}}
1512 }
1513 \clearpage
1514 % P2: empty
1515 \thispagestyle{empty}
1516 \cleardoublepage
1517 % P3: 版权使用授权书
1518 \thispagestyle{empty}
1519 {
1520 \linespread{1.6}\zihao{4}
1521
1522 \vspace*{\stretch{1}}
1523
1524 \begin{center}
1525 \zihao{-2}\bfseries\sffamily 上海科技大学\\毕业论文(设计)版权使用授权书
1526 \end{center}
1527
1528 \vspace*{\stretch{1}}
1529
1530 本毕业论文(设计)作者同意学校保留并向国家有关部门或机构送交论文的复印件和电子版,%
1531 允许论文被查阅和借阅。本人授权上海科技大学可以将本毕业论文(设计)的全部或部分内容%
1532 编入有关数据库进行检索,可以采用影印、缩印或扫描等复制手段保存和汇编本%
1533 毕业论文(设计)。
1534
1535 \hspace*{6\ccwd}\textbf{保\hspace*{1\ccwd}密}$\square$,%
1536 在\uline{\mbox{\hspace*{2\ccwd}}}年解密后适用本授权书。
1537
1538 本论文属于
1539
1540 \hspace*{6\ccwd}\textbf{不保密}$\square$。
1541
1542 (请在以上方框内打“\checkmark”)
1543
1544 \vspace*{\stretch{3}}
1545
1546 \noindent 作者签名:\hspace{12.5\ccwd}指导教师签名:
1547
1548 \vspace*{\stretch{1}}
1549
1550 \noindent 日期:%
1551 \hspace*{2.5\ccwd}年%
1552 \hspace*{1.5\ccwd}月%
1553 \hspace*{1.5\ccwd}日%
1554 \hspace*{6\ccwd}日期:%
1555 \hspace*{2.5\ccwd}年%
1556 \hspace*{1.5\ccwd}月%
1557 \hspace*{1.5\ccwd}日
1558
1559 \vspace{\stretch{4}}
1560 }
1561 \clearpage
1562 % P4: empty
1563 \thispagestyle{empty}
1564 \cleardoublepage
1565 }
1566 % ------------------------------------------------------------------------------
1567 % Abstract
1568 % ------------------------------------------------------------------------------
1569 \newenvironment{abstract}[1][\sht@null@arg]{%
1570 \cleardoublepage%
1571 \ifthenelse{\equal{#1}{flattitle}}{%
1572 \def\sht@abs@title{\sht@flat@title}%
1573 }{%
1574 \def\sht@abs@title{\sht@title}%
1575 }%
1576 \ifsht@undergraduate
1577 \let\clearpage\relax%
1578 \vspace*{\baselineskip}%
1579 \begin{center}%
1580 \zihao{3}\bfseries\sffamily\sht@abs@title%
1581 \end{center}%
1582 \vspace*{\baselineskip}%
1583 \ctexset{chapter/format += \zihao{4}, chapter/beforeskip = 0pt}%
1584 \ifsht@comfort%
1585 \def\sht@abstract@name{摘\hspace{1\ccwd}要}
1586 \else%
1587 \def\sht@abstract@name{摘要}
1588 \fi
1589 \else%
1590 \def\sht@abstract@name{摘\hspace{1\ccwd}要}
1591 \fi
1592 \intobmk\chapter*{\sht@abstract@name}%
1593 }{%
1594 \vspace{\baselineskip}%
1595 \ifsht@undergraduate%
1596 \ifsht@comfort%
1597 \par\noindent{\bfseries\sffamily 关键词:} \sht@keywords%
1598 \else%
1599 \par\noindent{\zihao{-4}\bfseries\sffamily 关键词:} \sht@keywords%
1600 \fi%
1601 \else%
1602 \par\noindent{\bfseries 关键词:} \sht@keywords%
1603 \fi%
1604 }
1605 \newenvironment{abstract*}[1][\sht@null@arg]{%
1606 \cleardoublepage%
1607 \ifthenelse{\equal{#1}{flattitle}}{%
1608 \def\sht@abs@title@en{\sht@flat@title@upper@en}%
1609 }{%
1610 \def\sht@abs@title@en{\sht@title@en}%
1611 }%
1612 \ifsht@undergraduate
1613 \let\clearpage\relax%
1614 \vspace*{\baselineskip}%
1615 \begin{center}%
1616 \zihao{3}\bfseries\sht@abs@title@en%
1617 \end{center}%
1618 \vspace*{\baselineskip}%
1619 \ctexset{chapter/format += \zihao{4}\rmfamily, chapter/beforeskip = 0pt}%
1620 \intobmk\chapter*{ABSTRACT}%
1621 \else
1622 \intobmk\chapter*{Abstract}%
1623 \fi
1624 }{%
1625 \vspace{\baselineskip}%
1626 \ifsht@undergraduate%
1627 \ifsht@comfort%
1628 \par\noindent{\bfseries Key words:} \sht@keywords@en%
1629 \else%
1630 \par\noindent{\zihao{-4}\bfseries Key words:} \sht@keywords@en%
1631 \fi%
1632 \else%
1633 \par\noindent{\bfseries Key Words:} \sht@keywords@en%
1634 \fi%
1635 }
1636 % ------------------------------------------------------------------------------
1637 % Nomenclatures
1638 % ------------------------------------------------------------------------------
1639 \newcounter{sht@nomenclature@cnt}
1640 \setcounter{sht@nomenclature@cnt}{0}
1641 \def\sht@null@arg{}
1642 \newenvironment{nomenclatures}[1][\sht@null@arg]{%
1643 \ifnum\thesht@nomenclature@cnt=0
1644 \cleardoublepage
1645 \intobmk\chapter*{符号列表}%
1646 \fi
1647 \stepcounter{sht@nomenclature@cnt}
1648 \ifthenelse{\not \equal{#1}{\sht@null@arg}}{%
1649 \ifsht@undergraduate%
1650 \ctexset{section/format += \zihao{-4}, section/indent = 0pt}%
1651 \fi%
1652 \section*{#1}%
1653 }{
1654 \ifsht@undergraduate%
1655 \par\vspace{18pt}%
1656 \else%
1657 \par\vspace{24pt}%
1658 \fi%
1659 }
1660 \renewcommand{\item}[3][\sht@null@arg]{
1661 \ifthenelse{\not \equal{##1}{\sht@null@arg}}{
1662 \par\noindent\makebox[0.15\columnwidth][l]{##2}{{##3}\hfill{##1}}
1663 }{
1664 \par\noindent\makebox[0.15\columnwidth][l]{##2}{##3}
1665 }
1666 }
1667 \providecommand{\header}[3][\sht@null@arg]{
1668 \item[\textbf{##1}]{\textbf{##2}}{\textbf{##3}}
1669 }
1670 }{
1671 }
1672 % ------------------------------------------------------------------------------
1673 % Bibliography
1674 % ------------------------------------------------------------------------------
1675 \providecommand{\makebiblio}{%
1676 \renewcommand{\bibfont}{\zihao{5}}%
1677 \intotoc*{\cleardoublepage}{\bibname}%
1678 \urlstyle{same}%
1679 \printbibliography%
1680 \urlstyle{tt}%
1681 }
1682 % ------------------------------------------------------------------------------
1683 % Appendix
1684 % ------------------------------------------------------------------------------
1685 \LetLtxMacro{\origin@appendix}{\appendix}
1686 \renewcommand{\appendix}{%
1687 \origin@appendix%
1688 \intotoc*{\cleardoublepage}{\appendixname}%
1689 \settocdepth{part}%
1690 \ifsht@undergraduate%
1691 \pagestyle{MNNumberedWithLogo}%
1692 \else%
1693 \pagestyle{LRNumberedAppendix}%
1694 \fi%
1695 }
1696 % ------------------------------------------------------------------------------
1697 % Backmatter
1698 % ------------------------------------------------------------------------------
1699 \providecommand{\backmatter}{}
1700 \LetLtxMacro{\origin@backmatter}{\backmatter}
1701 \renewcommand{\backmatter}{%
1702 \origin@backmatter%
1703 \settocdepth{chapter}%
1704 \renewcommand{\chaptermark}[1]{%
1705 \markboth{##1}{}%
1706 }%
1707 \ifsht@undergraduate%
1708 \pagestyle{MNNumberedWithLogo}%
1709 \else%
1710 \pagestyle{LRNumbered}%
1711 \fi%
1712 \ifsht@undergraduate%
1713 \ctexset{section/format += \zihao{-4}, section/indent = 0pt}%
1714 \fi%
1715 }
1716 \newcounter{sht@resume@cnt}
1717 \setcounter{sht@resume@cnt}{0}
1718 \newcommand{\sht@check@resume@title}{
1719 \ifnum\thesht@resume@cnt=0
1720 \cleardoublepage
1721 \chapter{作者简历及攻读学位期间发表的学术论文与研究成果}
1722 \fi
1723 \stepcounter{sht@resume@cnt}
1724 }
1725 \newenvironment{resume}{%
1726 \sht@check@resume@title
1727 \section*{作者简历:}
1728 \ifsht@anonymous
1729 \sht@anonymous@str\par
1730 \comment
1731 \fi
1732 }{%
1733 \ifsht@anonymous
1734 \endcomment
1735 \fi
1736 }
1737 \newenvironment{publications}{%
1738 \sht@check@resume@title
1739 \ifsht@anonymous
1740 \comment
1741 \fi
1742 \section*{已发表(或正式接受)的学术论文:}
1743 }{%
1744 \ifsht@anonymous
1745 \endcomment
1746 \fi
1747 }
1748 \newenvironment{publications*}{%
1749 \sht@check@resume@title
1750 \ifthenelse{\not \boolean{sht@anonymous}}{
1751 \comment
1752 }{}
1753 \section*{已发表(或正式接受)的学术论文:}
1754 }{%
1755 \ifthenelse{\not \boolean{sht@anonymous}}{
1756 \endcomment
1757 }{}
1758 }
1759 \newenvironment{patents}{%
1760 \sht@check@resume@title
1761 \ifsht@anonymous
1762 \comment
1763 \fi
1764 \section*{申请或已获得的专利:}
1765 }{%
1766 \ifsht@anonymous
1767 \endcomment
1768 \fi
1769 }
1770 \newenvironment{patents*}{%
1771 \sht@check@resume@title
1772 \ifthenelse{\not \boolean{sht@anonymous}}{
1773 \comment
1774 }{}
1775 \section*{申请或已获得的专利:}
1776 }{%
1777 \ifthenelse{\not \boolean{sht@anonymous}}{
1778 \endcomment
1779 }{}
1780 }
1781 \newenvironment{projects}{%
1782 \sht@check@resume@title
1783 \section*{参加的研究项目及获奖情况:}
1784 \ifsht@anonymous
1785 \sht@anonymous@str\par
1786 \comment
1787 \fi
1788 }{%
1789 \ifsht@anonymous
1790 \endcomment
1791 \fi
1792 }
1793 \newenvironment{acknowledgement}{%
1794 \ifsht@anonymous
1795 \comment
1796 \else
1797 \cleardoublepage
1798 \chapter[致谢]{致\hspace{1\ccwd}谢}\chaptermark{致\hspace{1\ccwd}谢}%
1799 \fi
1800 }{%
1801 \ifsht@anonymous
1802 \endcomment
1803 \fi
1804 }
1805 % ==============================================================================
1806 % Post-processing
1807 % ==============================================================================
1808 \AtEndDocument{
1809 \cleardoublepage
1810 }
1811 \endinput