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