Skip to content

Instantly share code, notes, and snippets.

@l1997i
Last active April 28, 2020 05:05
Show Gist options
  • Select an option

  • Save l1997i/edd0f603018fb0a74cedff344b30dae8 to your computer and use it in GitHub Desktop.

Select an option

Save l1997i/edd0f603018fb0a74cedff344b30dae8 to your computer and use it in GitHub Desktop.
My snippet for LaTeX in VS Code
{
"使用Elegant文档模版": {
"prefix": "elegant",
"body": [
"\\documentclass[${1:cn},${2:hazy},${3:blue},14pt,${4:normal}]{${5:elegantnote}}",
"\t% 模版类:elegantnote和elegantpaper通用可替换",
"\t% 护眼模式(geye)和朦胧模式(hazy)",
"\t% pad, kindle, pc, normal, screen",
"\t% 颜色主题:blue(默认),green,cyan,sakura和black",
"\t% 4类环境 之 定理类:theorem,lemma,proposition,corollary;",
"\t% 4类环境 之 定义类:definition,conjecture,example; ",
"\t% 4类环境 之 备注类:remark,note,case;",
"\t% 4类环境 之 证明类:proof。",
"\\title{${6:My Tittle}}",
"\\author{${7:Li Li}}",
"\\institute{${8:Nanjing University of Science and Technology}}",
"\\version{${9:1.00}}",
"\\date{\\zhtoday}",
"\\begin{document}",
"\\maketitle",
"\\section{${10:<Section 1>}}",
"\\end{document}",
"$0"
],
"description": "使用Elegant文档模版"
},
"插入图片": {
"prefix": "figure",
"body": [
"\\begin{figure}[htp]",
"\t\\centering",
"\t\\includegraphics[width=0.3\\textwidth]{$1}",
"\t\\caption{${2:<caption>}}",
"\t\\label{fig:${3:<label>}}",
"\\end{figure}",
"$0"
],
"description": "插入图片"
},
"插入带编号公式": {
"prefix": "equation",
"body": [
"\\begin{equation}\\label{equ:${1:<label>}}",
"\t$2",
"\\end{equation}",
"$0"
],
"description": "插入带编号公式"
},
"引用minted宏包":{
"prefix": "useMinted",
"body": [
"\\usepackage[cache=false]{minted}\t% 代码高亮",
"\t%NOTE: 编译时需要开启 shell-escape",
"\t% 例如使用 xelatex-shell-escape 进行编译",
"\\usemintedstyle{${1:xcode}}",
"\t% default, emacs, friendly, colorful, autumn, murphy,",
"\t% manni, monokai, perldoc, pastie, borland, trac, native,", "\t% fruity, bw, vim, vs, tango, rrt, xcode, igor, ",
"\t% paraiso-light, paraiso-dark, lovelace, algol, algol_nu, ",
"\t% arduino, rainbow_dash, abap, solarized-dark, ",
"\t% solarized-light, sas, stata, stata-light, stata-dark, inkpot",
"\\setminted{encoding=utf8,",
"\tbreaklines,\t% 自动换行",
"\tmathescape,\t% 支持注释显示数学公式",
"\tlinenos,\t% 显示行号",
"\tframe=single,\t% 显示边框",
"\trulecolor=purple!50!black,\t% 边框颜色",
"\ttexcl=false}\t% 是否支持注释显示LaTeX格式",
"$0"
],
"description": "引用minted宏包"
},
"minted外部代码": {
"prefix": "code_minted",
"body": [
"% REQUIRE: useMinted | \\usepackage[cache=false]{minted}",
"\\inputminted[]{${1:<language>}}{${2:<path>}}",
"$0"
],
"description": "插入minted外部代码\ntexcl 设置是否启用在注释中使用latex代码\n格式:\\inputminted[⟨options⟩]{⟨language⟩}{⟨filename⟩}"
},
"minted内部代码": {
"prefix": "code_minted_inside",
"body": [
"% REQUIRE: useMinted | \\usepackage[cache=false]{minted}",
"\\begin{minted}[]{${1:<language>}}",
"${2:Your code here.}",
"\\end{minted}",
"$0"
],
"description": "插入minted内部代码\ntexcl 设置是否启用在注释中使用latex代码\n通过highlightcolor指定高亮行颜色\n通过highlightlines指定高亮行号"
},
"引用listings宏包及设置语法高亮格式":{
"prefix": "useListings",
"body": [
"\\usepackage{listings}\t% 语法显示",
"\\usepackage{xcolor}\t% 使用颜色宏包",
"\\lstset{numbers=left,",
"\tnumberstyle=\\tiny, keywordstyle=\\color{blue!70}, commentstyle=\\color{red!50!green!50!blue!50},",
"\tframe=shadowbox, rulesepcolor=\\color{red!20!green!20!blue!20},",
"\tescapeinside=``}\t%语法高亮格式",
"$0"
],
"description": "引用listings宏包及设置语法高亮格式"
},
"listings外部代码": {
"prefix": "code_listings",
"body": [
"% REQUIRE: useListings |* \\usepackage{listings}",
"\\lstinputlisting[language=$1]{${2:<path>}}",
"$0"
],
"description": "插入listings外部代码"
},
"listings内部代码": {
"prefix": "code_listings_inside",
"body": [
"% REQUIRE: useListings |* \\usepackage{listings}",
"\\begin{lstlisting}[language=$1]",
"${2:Your code here.}",
"\\end{lstlisting}",
"$0"
],
"description": "插入listings内部代码"
},
"无序枚举":{
"prefix": "itemize",
"body": [
"\\begin{itemize}",
"\t\\item $1",
"\t\\item $2",
"\\end{itemize}"
],
"description": "无序枚举"
},
"顺序枚举":{
"prefix": "enumerate",
"body": [
"\\begin{enumerate}",
"\t\\item $1",
"\t\\item $2",
"\\end{enumerate}"
],
"description": "顺序枚举"
},
"单项":{
"prefix": "item",
"body": [
"\\item $1",
"$0"
],
"description": "单项"
},
"引用参考文献 GB2015宏包":{
"prefix": "useBib_GB2015",
"body": [
"% !BIB program = bibtex",
"\\usepackage[numbers]{gbt7714}",
"\t% REQUIRE: 需要引入gbt7714.bst和sty",
"\t% REQUIRE: 文末使用 \\bibliography 命令生成参考文献表",
"\t% 作者年份制使用 authoryear 参数",
"\t% 使用authoryear时,中文文献必在 key 域填写作者姓名的拼音",
"\t% 例如 key = {ma3 ke4 si1 en1 ge2 si1},",
"\t% 在正文中 \\cite 文献",
"\t% 不再需要调用 \\bibliographystyle 命令",
"\t% 同一处引用多篇文献时,应将各篇文献的 key 一同写在 \\cite 命令中,",
"\t% 如 \\cite{knuth84,lamport94,mittelbach04}。",
"$0"
],
"description": "引用参考文献 GB/T 7714-2015宏包"
},
"自定义参考文献上标命令":{
"prefix": "def_upcite",
"body": [
"\\newcommand{\\upcite}[1]{{\\textsuperscript{\\cite{#1}}}}\t%自定义参考文献上标",
"$0"
],
"description": "自定义参考文献上标命令"
},
"隐藏超链接的彩色方框":{
"prefix": "link_div_monochrome",
"body": [
"\\hypersetup{hidelinks}\t%隐藏超链接的绿色方框",
"$0"
],
"description": "隐藏CTex文档中的超链接的彩色方框"
},
"超链接文本重新配色":{
"prefix": "link_recolor",
"body": [
"\\hypersetup{pagebackref,colorlinks}",
"\t% REQUIRE: \\usepackage{hyperref}",
"\t% 超链接文本重新配色",
"$0"
],
"description": "超链接文本重新配色"
},
"使用ctex中文模版":{
"prefix": "ctex",
"body": [
"\\usepackage[UTF8, space, hyperref]{ctex}\t%使用ctex中文模版",
"$0"
],
"description": "使用ctex中文模版"
},
"目录自动生成超链接":{
"prefix": "hyperref",
"body": [
"\\usepackage{hyperref}",
"\\hypersetup{pagebackref,colorlinks}",
"\t% 其中pagebackref实现从参考文献列表反连接到文中引用该文献的位置",
"\t% colorlinks实现的是将引用链接用相应的颜色进行标记而不是矩形框进行标记",
"$0"
],
"description": "目录自动生成超链接、反向链接和去除方框"
},
"并排子图":{
"prefix": "subFigure",
"body": [
"\\begin{figure}[thb]",
"% REQUIRE: \\usepackage{subfig}",
"% REQUIRE: \\usepackage{graphicx}",
"\t\\centering",
"\t\\subfloat[${3:<subCaption1>}]{",
"\t\t\\includegraphics[width=0.25\\textwidth]{${6:<path1>}}",
"\t}",
"\t\\subfloat[${4:<subCaption2>}]{",
"\t\t\\includegraphics[width=0.25\\textwidth]{${7:<path2>}}",
"\t}",
"\t\\subfloat[${5:<subCaption3>}]{",
"\t\t\\includegraphics[width=0.25\\textwidth]{${8:<path3>}}",
"\t}",
"\t\\caption{${1:<caption>}}",
"\t\\label{fig:${2:<label>}}",
"\\end{figure}",
"$0"
],
"description": "并排子图\n需要 \\usepackage{subfig}"
},
"引入cleveref智能引用宏包":{
"prefix": "useCleveref",
"body": [
"\\usepackage{cleveref}\t% 引入cleveref智能引用宏包",
"\\crefname{${1:figure}}{${2:figure}}{${2:figure}s}",
"\t% \\crefname{类型:equation、table、figure、section等}{单数形式}{复数形式}",
"$0"
],
"description": "隐藏CTex文档中的超链接的彩色方框"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment