-
Notifications
You must be signed in to change notification settings - Fork 3
/
plugin.tex
234 lines (207 loc) · 7.88 KB
/
plugin.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
\section{宏包与多语言}
\subsection{宏包和TexLive发行版的关系}
\begin{frame}{宏包是什么}
% itemize
很多时候需要自己安装宏包
\begin{itemize}
\item TexLive是包含了若干个常见的宏包和编译器的集合
\item 许多的宏包是发行版没有预装的
\item 宏包需要更新(TEX Live 升级间隔的尴尬时期,或者宏包有重大变化)
\end{itemize}
宏包管理软件tlmgr
\begin{itemize}
\item<+-> Windows
\begin{itemize}
\item 开始菜单里找 TeX Live Manager
\item 设置仓库地址 \texttt{tlmgr option repository https://mirrors.sustech.edu.cn/CTAN/systems/texlive/tlnet}
\item \texttt{tlmgr install <pkgname>} 安装、 \texttt{tlmgr update --self --all} 全部更新
\end{itemize}
\item<+-> Mac
\begin{itemize}
\item 开始菜单里找 CTeX / MiKTeX -> Package Manager
\item 在 WinEdt 里 MiKTeX \texttt{Options -> Packages}
\end{itemize}
\end{itemize}
\vspace{0.4cm} % vertical space
\end{frame}
{\nologo
\begin{frame}[fragile]
\frametitle{宏包推荐(\textbf{先读文档}后使用)}
% \vspace{-1em}
\hspace{-3.5em}
\begin{minipage}[t]{1.2\linewidth}%
\begin{multicols}{3}
\begin{itemize}
\item 必备
\begin{itemize}
\item \pkg{amsmath公式}
\item \pkg{graphicx插图}
\item \pkg{hyperref超链接}
\end{itemize}
\item 样式
\begin{itemize}
\item \pkg{caption图注}
\item \pkg{enumitem列表}
\item \pkg{fancyhdr页眉页脚}
\item \pkg{footmisc脚注}
\item \pkg{geometry页面规格(纸张,边距)}
\item \pkg{titlesec标题格式}
\end{itemize}
\item 数学
\begin{itemize}
\item \pkg{bm粗体数学符号}
\item \pkg{mathtools公式增强}
\item \pkg{physics物理符号增强}
\item \pkg{unicode-math数学符号(unicode模式)}
\end{itemize}
\item 表格
\begin{itemize}
\item \pkg{array}
\item \pkg{booktabs表格高级样式}
\item \pkg{longtable跨页表格}
\item \pkg{tabularx可变宽度表}
\end{itemize}
\item 插图、绘图
\begin{itemize}
\item \pkg{float}
\item \pkg{pdfpages嵌入PDF}
\item \pkg{standalone}
\item \pkg{subfig子图片}
\item \pkg{pgf}/\pkg{tikz流程图}
\item \pkg{pgfplots通用数据作图}
\end{itemize}
\item 字体
\begin{itemize}
\item \pkg{newpx}
\item \pkg{pifont}
\item \pkg{fontspec引入/声明外部字体}
\end{itemize}
\item 各种功能
\begin{itemize}
\item \pkg{algorithm2e伪代码}
\item \pkg{beamer幻灯片}
\item \pkg{biblatex引文}
\item \pkg{listings列表}
\item \pkg{mhchem化学式}
\item \pkg{microtype缩进控制}
\item \pkg{minted代码高亮}
\item \pkg{natbib印文}
\item \pkg{siunitx度量衡}
\item \pkg{xcolor定义颜色}
\end{itemize}
\item 多语言
\begin{itemize}
\item \pkg{babel}
\item \pkg{polyglossia}
\item \pkg{ctex}
\item \pkg{xeCJK中日韩文字}
\end{itemize}
\end{itemize}
\end{multicols}
\end{minipage}
\end{frame}
}
\begin{frame}[fragile]{宏包示例: Tikz (画图)}
\vspace{-2em}
\begin{columns}
\begin{column}{.6\textwidth}
\lstset{language=[LaTeX]TeX}
\begin{lstlisting}[basicstyle=\ttfamily\tiny]
\usetikzlibrary{positioning, arrows, shapes, shapes.multipart, backgrounds, calc, automata} %需先导入所需的tikz形状库
\tikzstyle{mcstate} = [state, fill=gray!20!white]
\begin{tikzpicture}[draw=Green, very thick, >=latex', auto]
\node [mcstate] (s4) {4};
\node [mcstate, right=of s4] (s1) {1};
\node [mcstate, below=of s4] (s2) {2};
\node [mcstate, right=of s2] (s6) {6};
\node [mcstate, right=of s1] (s5) {5};
\node [mcstate, above=of s1] (s3) {3};
\draw [->]
(s4) edge [loop left] node {1/3} (s4)
(s4) edge [above] node {1/3} (s1)
(s4) edge node {1/3} (s2)
(s1) edge node {1} (s3)
(s3) edge [above] node {1} (s5)
(s5) edge node {1} (s1)
(s2) edge [bend left] node {1} (s6)
(s6) edge [bend left] node {1/2} (s2)
(s6) edge [loop right] node {1/2} (s6);
\end{tikzpicture}
\end{lstlisting}
\end{column}
\begin{column}{.4\textwidth}
\begin{figure}[H]
\centering
\tikzstyle{mcstate} = [state, fill=gray!20!white]
\begin{tikzpicture}[draw=Green, very thick, >=latex', auto]
\node [mcstate] (s4) {4};
\node [mcstate, right=of s4] (s1) {1};
\node [mcstate, below=of s4] (s2) {2};
\node [mcstate, right=of s2] (s6) {6};
\node [mcstate, right=of s1] (s5) {5};
\node [mcstate, above=of s1] (s3) {3};
\draw [->]
(s4) edge [loop left] node {1/3} (s4)
(s4) edge [above] node {1/3} (s1)
(s4) edge node {1/3} (s2)
(s1) edge node {1} (s3)
(s3) edge [above] node {1} (s5)
(s5) edge node {1} (s1)
(s2) edge [bend left] node {1} (s6)
(s6) edge [bend left] node {1/2} (s2)
(s6) edge [loop right] node {1/2} (s6)
;
\end{tikzpicture}
\caption{Markov Chain}
\end{figure}
\end{column}
\end{columns}
Ref: \url{https://github.com/paulzfm/TikZ-Tunight} and TUNA 的有关讲座\link{https://tuna.moe/event/2020/tikz/}
\end{frame}
\begin{frame}[fragile]{宏包示例: \pkg{algorithm2e} (伪代码)}
\begin{columns}
\begin{column}{.6\textwidth}
\lstset{language=[LaTeX]TeX}
\begin{lstlisting}[basicstyle=\ttfamily\footnotesize]
\begin{algorithm}[H]
\SetAlgoLined
\LinesNumbered
\SetKwInOut{Input}{input}
\SetKwInOut{Output}{output}
\Input{x: float, y: float}
\Output{r: float}
\While{True}{
r = x + y\;
\eIf{r >= 30}{
``O valor de $r$ é maior ou iqual a 10.''\;
break\;
}{
``O valor de $r$ = '', r\;
}
}
\caption{Algorithm Example}
\end{algorithm}
\end{lstlisting}
\end{column}
\begin{column}{.4\textwidth}
\begin{algorithm}[H]
\SetAlgoLined
\LinesNumbered
\SetKwInOut{Input}{input}
\SetKwInOut{Output}{output}
\Input{x: float, y: float}
\Output{r: float}
\While{True}{
r = x + y\;
\eIf{r >= 30}{
``O valor de $r$ é maior ou iqual a 10.''\;
break\;
}{
``O valor de $r$ = '', r\;
}
}
\caption{Algorithm Example}
\end{algorithm}
\end{column}
\end{columns}
\end{frame}