-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tex
237 lines (185 loc) · 7.05 KB
/
main.tex
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
%!TeX program = xelatex
\documentclass[12pt,hyperref,a4paper,UTF8]{ctexart}
\usepackage{TongjiReport}
%%-------------------------------正文开始---------------------------%%
\begin{document}
%%-----------------------封面--------------------%%
\cover
%%------------------摘要-------------%%
%\begin{abstract}
%
%在此填写摘要内容
%
%\end{abstract}
\thispagestyle{empty} % 首页不显示页码
%%--------------------------目录页------------------------%%
\newpage
\tableofcontents
%%------------------------正文页从这里开始-------------------%
\newpage
%%可选择这里也放一个标题
%\begin{center}
% \title{ \Huge \textbf{{标题}}}
%\end{center}
\section{模板说明}
本模板主要适用于一些课程的平时论文以及期末论文,默认页边距为2.5cm,中文宋体,英文Times New Roman,字号为12pt(小四)。
编译方式:\verb|xelatex -> bibtex -> xelatex*2|
默认模板文件由以下四部分组成:
\begin{itemize}
\item \texttt{main.tex} 主文件
\item \texttt{reference.bib} 参考文献,使用bibtex
\item \texttt{TongjiReport.sty} 文档格式控制,包括一些基础的设置,如页眉、标题、学院、学号、姓名等
\item \texttt{figures} 放置图片的文件夹
\end{itemize}
第一次使用时需前往\texttt{TongjiReport.sty} 对标题、姓名、学号、院所、页眉等进行设置,设置完后即可一劳永逸,封面LOGO亦可替换。
默认带有封面页以及目录页,页码从目录页开始。
\section{一些插入功能}
\subsection{插入公式}
行内公式$v-\varepsilon+\phi=2$。
插入行间公式如\autoref{Euler}:
\begin{equation}
v-\varepsilon+\phi=2
\label{Euler}
\end{equation}
\subsection{插入图片}
Tongji校徽如\autoref{Tongji}所示,注意这里使用了\verb|~\autoref{}|命令,也就是会自动生成“图”“式”等前缀,无需手动输入。
此外,模版同时提供了校徽,如\autoref{Tongji_notitle}所示,请根据实际需求使用。
\begin{figure}[!htbp]
\centering
\includegraphics[width =.5\textwidth]{figures/tongji_logo.pdf}
\caption{同济大学}
\label{Tongji}
\end{figure}
\begin{figure}[!htbp]
\centering
\begin{subfigure}[b]{0.47\textwidth}
\includegraphics[width =\textwidth]{figures/tongji_logo_notitle.pdf}
\caption{左子图}
\label{left}
\end{subfigure}
\begin{subfigure}[b]{0.47\textwidth}
\includegraphics[width =\textwidth]{figures/tongji_logo_notitle.pdf}
\caption{右子图}
\label{right}
\end{subfigure}
\caption{校徽}
\label{Tongji_notitle}
\end{figure}
插入上面图片的代码:
\begin{verbatim}
\begin{figure}[!htbp]
\centering
\includegraphics[width =.4\textwidth]{figures/tongji_logo.pdf}
\caption{同济大学}
\label{Tongji}
\end{figure}
\end{verbatim}
\subsection{插入文本框}
本模板定义了一个圆角灰底的文本框,使用简化命令\verb|\tbox{}|即可,如果你不喜欢,可以前往 \texttt{TongjiReport.sty}对其进行修改。
\tbox{
这是一个圆角灰底的文本框
}
\subsection{插入表格}
本模板文件如\autoref{doc}所示。
\begin{table}[!htbp]
\centering
\begin{tabular}{l | l}
\hline
文件名 & 说明 \\
\hline
\texttt{main.tex} & 主文件 \\
\texttt{reference.bib} & 参考文献 \\
\texttt{TongjiReport.sty} & 文档格式控制\\
\texttt{figures} & 图片文件夹 \\
\hline
\end{tabular}
\caption{本模板文件组成}
\label{doc}
\end{table}
\subsection{插入代码}
本模板有一种较为粗糙的代码高亮方式,使用\verb|\begin{lstlisting}|模块来使用,以C++为例,一下程序显示模块的参数,选择语言language为C++,使用caption来指定代码块标题,具体为\verb|[language=C++, caption=My Code, label=lst:code]|,C++代码简单高亮如下:
\begin{lstlisting}[language=C++, caption=My Code, label=lst:code]
#include<iostream>
using namespace std;
// This is a sample struct
struct node
{
int x;
int y;
};
int main()
{
struct node p;
cout << "Enter x and y: ";
cin >> p.x >> p.y;
return 0;
}
\end{lstlisting}
\subsection{定理环境}
本模板提供了一些较常见的定理环境,如\autoref{Theorem}、\autoref{Lemma}、\autoref{Corollary}、\autoref{Proposition}、\autoref{Definition}、\autoref{Example}、\autoref{proof}等。使用方法为\verb|\begin{Theorem}|、\verb|\begin{Lemma}|、\verb|\begin{Corollary}|、\verb|\begin{Proposition}|、\verb|\begin{Definition}|、\verb|\begin{Example}|、\verb|\begin{proof}|。
\begin{Theorem}
Test
\label{Theorem}
\end{Theorem}
\begin{Lemma}
Test
\label{Lemma}
\end{Lemma}
\begin{Corollary}
Test
\label{Corollary}
\end{Corollary}
\begin{Proposition}
Test
\label{Proposition}
\end{Proposition}
\begin{Definition}
Test
\label{Definition}
\end{Definition}
\begin{Example}
Test
\label{Example}
\end{Example}
\begin{proof}
Test
\label{proof}
\end{proof}
\subsection{插入伪代码}
本模板还提供伪代码的插入,使用\verb|\begin{algorithm}|和\verb|\end{algorithm}|模块,具体使用方法请参考\href{https://en.wikibooks.org/wiki/LaTeX/Algorithms}{LaTeX/Algorithms},以下是Dijkstra算法的伪代码\ref{alg:dijkstra}:
\begin{algorithm}
\caption{Dijkstra's Algorithm}
\label{alg:dijkstra}
\begin{algorithmic}[1]
\Require Graph $G=(V,E)$ with non-negative weights, source vertex $s$
\Ensure Shortest path distances $d[v]$ from source $s$ to each vertex $v \in V$
\State Initialize distance array $d[]$, for each vertex $v \in V$, set $d[v] = \infty$
\State Set $d[s] = 0$
\State Initialize priority queue $Q$, insert all vertices with their distances
\While{$Q$ is not empty}
\State Extract vertex $v$ with minimum distance from $Q$
\For{each neighbor $u$ of $v$}
\State Calculate alternative path distance $\text{alt} = d[v] + \text{weight}(v, u)$
\If{$\text{alt} < d[u]$}
\State Update $d[u] = \text{alt}$
\State Decrease key of $u$ in $Q$ to $\text{alt}$
\EndIf
\EndFor
\EndWhile
\end{algorithmic}
\end{algorithm}
\subsection{插入参考文献}
直接使用\verb|\cite{}|即可。
例如:
\textit{ 此处引用了文献\cite{OFDMAbackscatter}。此处引用了文献\cite{DigiScatter}}
引用过的文献\cite{Wang2023}会自动出现在参考文献中\cite{Fan2022}。
\section{写在最后}
\subsection{主要参考}
\begin{itemize}
\item Github: \url{https://github.com/Jiazhen-Lei/SJTU_Course_Template_Latex}
\item Overleaf: \url{https://www.overleaf.com/latex/}
\end{itemize}
%%----------- 参考文献 -------------------%%
%在reference.bib文件中填写参考文献,此处自动生成
\reference
\end{document}