LyX Cheatsheet
lyx 个人速查
随时补充。以下内容均扔到导言区
CTeX #
1\usepackage{ctex}
2\usepackage{color}“语言”选汉语(繁体中文)
beamer #
1\usepackage{ctex}
2\usepackage{color}
3
4\usetheme{Szeged}
5\usecolortheme{beaver}
6% or ...
7
8\setbeamercovered{transparent}
9% or whatever (possibly just delete it)代码块 #
1\usepackage{listings}
2
3\lstset{
4 basicstyle = \sffamily, % 基本代码风格
5 keywordstyle = \bfseries, % 关键字风格
6 commentstyle = \rmfamily, % 注释的风格,斜体
7 stringstyle = \ttfamily, % 字符串风格
8 flexiblecolumns, % 别问为什么,加上这个
9 numbers = left, % 行号的位置在左边
10 showspaces = false, % 是否显示空格,显示了有点乱,所以不现实了
11 numberstyle = \zihao{-5}\ttfamily, % 行号的样式,小五号,tt等宽字体
12 showstringspaces = false,
13 captionpos = t, % 这段代码的名字所呈现的位置,t指的是top上面
14 frame = shadowbox, % 显示边框
15 tabsize = 4
16}
17
18\lstdefinestyle{Python}{
19 language = Python, % 语言选Python
20 basicstyle = \zihao{-5}\ttfamily,
21 numberstyle = \zihao{-5}\ttfamily,
22 keywordstyle = \color{blue},
23 keywordstyle = [2] \color{teal},
24 stringstyle = \color{magenta},
25 commentstyle = \color{red}\rmfamily,
26 breaklines = true, % 自动换行,建议不要写太长的行
27 columns = fixed, % 如果不加这一句,字间距就不固定,很丑,必须加
28 basewidth = 0.5em,
29}
30
31\lstdefinestyle{C++}{
32 language = C++, % 语言选Cpp
33 basicstyle = \zihao{-5}\ttfamily,
34 numberstyle = \zihao{-5}\ttfamily,
35 keywordstyle = \color{blue},
36 keywordstyle = [2] \color{teal},
37 stringstyle = \color{magenta},
38 commentstyle = \color{red}\rmfamily,
39 breaklines = true, % 自动换行,建议不要写太长的行
40 columns = fixed, % 如果不加这一句,字间距就不固定,很丑,必须加
41 basewidth = 0.5em,
42}在正文中插入:
1\lstinputlisting[
2 style = C++,
3 caption = {\bf test.cpp},
4 label = {test.cpp}
5]{C:\\Users\\11\\Desktop\\test.cpp}