latex中文模板

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
% ctex_test.tex
\documentclass[UTF8]{ctexart}
\usepackage{geometry}
\geometry{a4paper,left=3cm,right=3cm,top=4cm,bottom=4cm}
\usepackage{ctex}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{amsmath}
\usepackage{url}
\usepackage[colorlinks=red, linkcolors=red]{hyperref}
\usepackage{listings}
\usepackage{xcolor}
\lstset{
basicstyle = \ttfamily, % 基本代码风格
keywordstyle = \bfseries\color{blue}, % 关键字风格
commentstyle = \rmfamily\itshape, % 注释的风格,斜体
stringstyle = \ttfamily, % 字符串风格
flexiblecolumns, % 别问为什么,加上这个
numbers = left, % 行号的位置在左边
showspaces = false, % 是否显示空格,显示了有点乱,所以不现实了
numberstyle = \zihao{-5}\ttfamily, % 行号的样式,小五号,tt等宽字体
showstringspaces = false,
captionpos = t, % 这段代码的名字所呈现的位置,t指的是top上面
frame = lrtb, % 显示边框
language = C++
}

% \lstdefinestyle{C++}{
% language = C++, % 语言选Python
% basicstyle = \zihao{-5}\ttfamily,
% numberstyle = \zihao{-5}\ttfamily,
% keywordstyle = \color{blue},
% % keywordstyle = [2] \color{teal},
% stringstyle = \color{magenta},
% commentstyle = \color{red}\ttfamily,
% breaklines = true, % 自动换行,建议不要写太长的行
% columns = fixed, % 如果不加这一句,字间距就不固定,很丑,必须加
% basewidth = 0.5em,
% }

\title{CSP小抄}
% \author{从蓉}
\begin{document}
\maketitle
% 这是一个CTEX的utf-8编码例子,{\kaishu 这里是楷体显示},{\songti 这里是宋体显示},{\heiti 这里是黑体显示},{\fangsong 这里是仿宋显示}。
\newpage
\tableofcontents
\newpage
\end{document}