% !TEX program = xelatex
\documentclass[12pt,hyperref,a4paper,UTF8]{ctexart}
\usepackage{CityUhomework}
\usepackage{listings}
\usepackage{xcolor}
% 定义可能使用到的颜色
\definecolor{CPPLight} {HTML} {686868}
\definecolor{CPPSteel} {HTML} {888888}
\definecolor{CPPDark} {HTML} {262626}
\definecolor{CPPBlue} {HTML} {4172A3}
\definecolor{CPPGreen} {HTML} {487818}
\definecolor{CPPBrown} {HTML} {A07040}
\definecolor{CPPRed} {HTML} {AD4D3A}
\definecolor{CPPViolet} {HTML} {7040A0}
\definecolor{CPPGray} {HTML} {B8B8B8}
\definecolor{keywordcolor}{rgb}{0.8,0.1,0.5}
\definecolor{webgreen}{rgb}{0,.5,0}
\definecolor{bgcolor}{rgb}{0.92,0.92,0.92}
\lstset{
breaklines = true, % 自动将长的代码行换行排版
extendedchars=false, % 解决代码跨页时,章节标题,页眉等汉字不显示的问题
columns=fixed,
numbers=left, % 在左侧显示行号
basicstyle=\zihao{-5}\ttfamily,
numberstyle=\small,
frame=none, % 不显示背景边框
% backgroundcolor=\color[RGB]{245,245,244}, % 设定背景颜色
keywordstyle=\color[RGB]{40,40,255}, % 设定关键字颜色
numberstyle=\footnotesize\color{darkgray}, % 设定行号格式
commentstyle=\it\color[RGB]{0,96,96}, % 设置代码注释的格式
stringstyle=\rmfamily\slshape\color[RGB]{128,0,0}, % 设置字符串格式
showstringspaces=false, % 不显示字符串中的空格
% frame=leftline,topline,rightline, bottomline %分别对应只在左侧,上方,右侧,下方有竖线
frame=shadowbox, % 设置阴影
rulesepcolor=\color{red!20!green!20!blue!20}, % 阴影颜色
basewidth=0.6em,
}
\lstdefinestyle{CPP}{
language=c++, % 设置语言
morekeywords={alignas,continute,friend,register,true,alignof,decltype,goto,
reinterpret_cast,try,asm,defult,if,return,typedef,auto,delete,inline,short,
typeid,bool,do,int,signed,typename,break,double,long,sizeof,union,case,
dynamic_cast,mutable,static,unsigned,catch,else,namespace,static_assert,using,
char,enum,new,static_cast,virtual,char16_t,char32_t,explict,noexcept,struct,
void,export,nullptr,switch,volatile,class,extern,operator,template,wchar_t,
const,false,private,this,while,constexpr,float,protected,thread_local,
const_cast,for,public,throw,std},
emph={map,set,multimap,multiset,unordered_map,unordered_set,
unordered_multiset,unordered_multimap,vector,string,list,deque,
array,stack,forwared_list,iostream,memory,shared_ptr,unique_ptr,
random,bitset,ostream,istream,cout,cin,endl,move,default_random_engine,
uniform_int_distribution,iterator,algorithm,functional,bing,numeric,},
emphstyle=\color{CPPViolet},
}
\lstdefinestyle{Python}{
language=Python,
}
%%------------------正文开始-----------------%%
\begin{document}
%%-----------------封面-------------------%%
\cover\
\thispagestyle{empty}% 首页不显示页码
%%-----------------摘要-------------------%%
\begin{abstract}
请在此处填写摘要
\end{abstract}
%%-----------------目录-------------------%%
\newpage
\tableofcontents
%%-----------------正文从此处开始-------------------%%
\newpage
\section{模板说明}
默认页边距为2.5cm,中文宋体,英文Times New Roman,字号为12pt。
\subsection{小节}
\subsubsection{小小节}
\section{样例}
\subsection{插入文本}
\textbf{加粗文本}
\textit{倾斜文本}
\underline{下划线文本}
\subsection{插入列表}
项目编号:
\begin{itemize}
\item XXX
\item XXX
\item XXX
\end{itemize}
\begin{enumerate}
\item XXX
\item XXX
\item XXX
\end{enumerate}
\subsection{插入数学公式}
行内公式:$\int_a^b f(x)dx = F(b)-F(a)$
数学公式排版样例:
\begin{equation}\label{eq:1}
\int_a^b f(x)dx = F(b)-F(a)
\end{equation}
\begin{equation}\label{eq:2}
E = mc^2
\end{equation}
\begin{equation}\label{eq:3}
x^2 \geq 0 \qquad \text{for all } x \in \mathbb{R}
\end{equation}
\begin{equation}\label{eq:4}
\lim_{n \to \infty}
\sum_{k=1}^n \frac{1}{k^2}
= \frac{\pi^2}{6}
\end{equation}
chi-squared distribution:
\begin{equation}\label{eq:5}
f(y) =
\begin{cases}
\frac{1}{2^{k/2}\Gamma(k/2)} x^{k/2-1} e^{-x/2} & y>0 \\
0 & \text{otherwise}
\end{cases}
\end{equation}
多行公式:
\begin{multline} \label{eq:6}
a + b + c + d + e + f
+ g + h + i \\
= j + k + l + m + n\\
= o + p + q + r + s\\
= t + u + v + x + z
\end{multline}
\begin{align} \label{eq:7}
a & = b + c \\
& = d + e
\end{align}
矩阵:
\begin{equation} \label{eq:8}
\begin{bmatrix}
x_{11} & x_{12} & \ldots & x_{1n} \\
x_{21} & x_{22} & \ldots & x_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
x_{n1} & x_{n2} & \ldots & x_{nn} \\
\end{bmatrix}
\end{equation}
定理:
\newtheorem{mass-energy equivalence}{质能方程}[section]
\begin{mass-energy equivalence} \label{thm:1}
$E = mc^2$
\end{mass-energy equivalence}
\subsection{插入表格和图片}
插入表格:
\begin{table}[h]
\begin{tabular}{|c|c|}% 通过添加 | 来表示是否需要绘制竖线
\hline % 在表格最上方绘制横线
(1,1) & (1,2) \\
\hline %在第一行和第二行之间绘制横线
(2,1) & (2,2) \\
\hline % 在表格最下方绘制横线
\end{tabular}
\end{table}
插入图片:
[scale=] 中的数可以控制图片大小;后面的括号表示图片的路径,请把图片上传到figures文件夹中;caption表示图片的标题
\begin{figure}[h]
\centering
\includegraphics[scale=0.1]{figures/FDS logo.jpg}
\caption{在此填写图片的标题}
\end{figure}
\subsection{插入高亮代码}
利用\verb|lstlisting| 配置
\begin{lstlisting}[style=CPP, title="c++代码"]
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!" << endl;
return 0;
}
\end{lstlisting}
\begin{lstlisting}[style=Python, title="Python代码"]
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 10, 100)
y = np.sin(x)
plt.plot(x, y)
plt.show()
\end{lstlisting}
\subsection{插入参考文献}
直接使用\verb|\cite{}|即可。
例如:
\textit{ 此处引用了文献\cite{liu2023backdoor}。此处引用了文献\cite{du2024sequential}}
引用过的文献会自动出现在参考文献中。
%%----------- 参考文献 -------------------%%
%在reference.bib文件中填写参考文献,此处自动生成
\reference
\end{document}

PDF Preview
Create an account to compile and preview