forked from OChicken/SCUT-Bachelor-Thesis-Template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.sty
125 lines (118 loc) · 7 KB
/
template.sty
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
% This file contains the core required packages in LaTeX which
% can be used in various document class z.B. article, report,
% CV and motivation letters
\ProvidesPackage{template}
\usepackage[fntef]{ctexcap} % Required for the Chinese and the corresponding section setting
\usepackage[top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry} % Required for the Word-like page
\usepackage{fancyhdr} % Required for custom headers
\usepackage{setspace} % Required for the space setting
\usepackage{titlesec} % Required for the Chapter & Section fonts adjustment
\usepackage{titletoc} % Required for the Content fonts adjustment
\usepackage[toc,page]{appendix} % Required for the appendix environment
\usepackage{lastpage} % Required to determine the last page for the footer
\usepackage{extramarks} % Required for headers and footers
\usepackage{courier} % Required for the courier font
\usepackage{float} % Required for the Here float
\usepackage{graphicx} % Required to insert images
\usepackage{wrapfig}
\usepackage{booktabs} % Required for the hline of the three lines table
\usepackage{multirow} % Required for the multirow of table
\usepackage{listings} % Required for insertion of code
\usepackage{indentfirst} % Required for the indent before each paragraph
\usepackage[bookmarks=true,colorlinks=true,linkcolor=black,anchorcolor=blue,citecolor=blue,urlcolor=blue]{hyperref}
%\usepackage{cite} % Required for the ref and cite
\usepackage[usenames,dvipsnames]{color} % Required for custom colors
\usepackage{courier} % Required for the courier font
\usepackage[font=footnotesize,tableposition=top]{caption} % Required for the footnote size captions of figures and tables
\usepackage[numbers,sort&compress]{natbib}
%----------------------------------------------------------------------------------------
% Math Display
%----------------------------------------------------------------------------------------
\usepackage{bm} % Required for the bold in math display
\usepackage{amsmath} % Required for the math display
\usepackage{amssymb} % Required for the math display
\usepackage{amsbsy} % Required for the math display
\usepackage{cancel} % Required for the cancel symbol in math display
\usepackage{amsthm} % Required for the theorem edition
\usepackage{array} % Required for the array in math display
\usepackage{ifthen} % Required for the conditional commands
%----------------------------------------------------------------------------------------
% Superscript citation
%----------------------------------------------------------------------------------------
\newcommand{\upcite}[1]{\textsuperscript{\textsuperscript{\cite{#1}}}}
%----------------------------------------------------------------------------------------
% Upright d in integrate
%----------------------------------------------------------------------------------------
\newcommand{\ud}{\mathrm{d}}
%----------------------------------------------------------------------------------------
% Code Inclusion Configuration
%----------------------------------------------------------------------------------------
\definecolor{MyDarkGreen}{rgb}{0.0,0.4,0.0} % This is the color used for comments
\lstloadlanguages{Python} % Load Python syntax for listings, for a list of other languages supported see: ftp://ftp.tex.ac.uk/tex-archive/macros/latex/contrib/listings/listings.pdf
\lstset{language=Python, % Use Python in this example
frame=single, % Single frame around code
%basicstyle=\ttfamily, % Use small true type font
keywordstyle=[1]\color{Blue}\bf, % Python functions bold and blue
keywordstyle=[2]\color{Purple}\it, % Python function arguments purple
keywordstyle=[3]\color{Blue}\underbar, % Custom functions underlined and blue
identifierstyle=, % Nothing special about identifiers
commentstyle=\color{Gray}, % Comments small dark green courier font
stringstyle=\color{Green}, % Strings are purple
showstringspaces=false, % Don't put marks in string spaces
tabsize=4, % 4 spaces per tab
% Put standard Python functions not included in the default language here
morekeywords={rand},
% Put Python function parameters here
morekeywords=[2]{on, off, interp},
% Put user defined functions here
morekeywords=[3]{test},
%
morecomment=[l][\color{Blue}]{...}, % Line continuation (...) like blue comment
numbers=left, % Line numbers on left
firstnumber=1, % Line numbers start with line 1
numberstyle=\tiny\color{Blue}, % Line numbers are blue and small
stepnumber=1 % Line numbers go in steps of 1
}
% Creates a new command to include a Python script, the first parameter is the filename of the script (without .py), the second parameter is the caption
\newcommand{\pythonscript}[2]{
\begin{itemize}
\begin{spacing}{1.0}
\item[]\lstinputlisting[caption=#2,label=#1]{#1.py}
\end{spacing}
\end{itemize}
}
%----------------------------------------------------------------------------------------
% Section related equations' number
%----------------------------------------------------------------------------------------
\makeatletter
\@addtoreset{equation}{section}
\makeatother
\renewcommand{\theequation}{\arabic{section}.\arabic{equation}}
%----------------------------------------------------------------------------------------
% Chapter & Section fonts adjustment
%----------------------------------------------------------------------------------------
\CTEXsetup[name={第,章},number={\chinese{section}},format={\centering\zihao{-2}\bfseries}]{section}
\titleformat{\subsection}{\zihao{-3}\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\zihao{4}\bfseries}{\thesubsubsection}{1em}{}
\CTEXsetup[,format={\raggedright\bfseries\zihao{-4}}]{paragraph}
%----------------------------------------------------------------------------------------
% Content fonts adjustment
%----------------------------------------------------------------------------------------
\renewcommand\contentsname{目\quad\quad 录} % Setup contents
\titlecontents{section}[0em]{\zihao{4}\bfseries}{\contentspush{\thecontentslabel \hspace{0.7em}}}
{}{\titlerule*[5pt]{.}\contentspage}
\titlecontents{subsection}[2.2em]{\zihao{-4}\songti}{\contentspush{\thecontentslabel\hspace{0.7em}}}
{}{\titlerule*[5pt]{.}\contentspage}
\titlecontents{subsubsection}[3.9em]{\zihao{-4}\songti}{\contentspush{\thecontentslabel\hspace{0.7em}}}
{}{\titlerule*[5pt]{.}\contentspage}
\titlespacing*{\subsection} {0pt}{1ex}{1ex} % Adjust the space between title and context
\titlespacing*{\subsubsection} {0pt}{1ex}{1ex}
%----------------------------------------------------------------------------------------
% Page header & Page footer setting
%----------------------------------------------------------------------------------------
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\sectionmark}[1]{\markboth{第\chinese{section} 章{\color{white}.} #1}{}}
\fancyhead[C]{\CJKfamily{song}华南理工大学学士学位论文}
\fancyhead[CO]{\CJKfamily{song}\leftmark}
\fancyfoot[C]{\thepage}