Kun's Blog

LaTeX 模板

模板:平时作业,报告,presentation等

经过长时间的使用以及琢磨,整理了一些有用的 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
% Setup Python code highlight
\usepackage{listings}
\usepackage{color}

\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}

\lstdefinestyle{mystyle}{
language=Python,
frame=lines,
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
% \lstset{caption={Insert code directly in your document}}
% \lstset{label={lst:code_direct}}
\lstset{style=mystyle}


% ---------- some macro for typing ----------------
%\numberwithin{equation}{section}
\theoremstyle{plain}
%\newtheorem{definition}{Definition}[section]
%\newtheorem{theorem}{Theorem}[section]
%\newtheorem{lemma}{Lemma}[section]
\newtheorem{proposition}{Proposition}[section]
% \newtheorem{corollary}{Corollary}[section]
\newtheorem{remark}{Remark}[section]
\newtheorem{conjecture}{Conjecture}[section]
\newtheorem{assumption}{Assumption}[section]

\newcommand{\R}{\mathbb{R}} % real numbers
\newcommand{\Q}{\mathbb{Q}} % rational numbers
\newcommand{\Z}{\mathbb{Z}} % integer numbers
\newcommand{\N}{\mathbb{N}} % natural numbers
\newcommand{\C}{\mathbb{C}} %
\newcommand{\E}{\mathbb{E}} % expectation

\newcommand{\fl}[1]{\lfloor{#1}\rfloor} % floor of a number
\newcommand{\cl}[1]{\lceil{#1}\rceil} % ceiling of a number
\newcommand{\norm}[2]{\|{#1}\|_{#2}} % norm
\newcommand{\id}[1]{{\bf{1}}_{{{#1}}}} % index function

% for highlighting changes
\usepackage[normalem]{ulem}
\newcommand{\delete}[1]{\textcolor{red}{\sout{#1}}} % delete
\newcommand{\replace}[2]{\textcolor{red}{\sout{#1}} \textcolor{blue}{{#2}}} % replace #1 with #2
\newcommand{\red}[1]{\textcolor{red}{#1}} % red / emphasize
\newcommand{\comment}[2]{\textcolor{blue}{({#1}: {#2})}} % comments
\newcommand{\kxie}[1]{\textcolor{magenta}{{Kun: }{#1}}} % comments by Kun
\newcommand{\purple}[1]{\textcolor{myPrince}{#1}} % purple / example
\newcommand{\blue}[1]{\textcolor{blue}{#1}} % blue

\definecolor{myBlue}{RGB}{0,51,102}
\definecolor{myGold}{RGB}{28,122,166}
\definecolor{myPrince}{RGB}{188,47,235}

模板下载

为了防止以后会遗忘,写了这个文档作为备份。等有空的时候,专门建一个备份Git是最好的。

最后附上本人的两个模板,一个是写文件的用的,另一个是做presentation用的。

  1. article.tex
  2. presentation.tex,需要额外配置文件点我下载