summaryrefslogtreecommitdiffstats
path: root/.config/nvim/my_snippets
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/my_snippets')
-rw-r--r--.config/nvim/my_snippets/latex.snippets5
-rw-r--r--.config/nvim/my_snippets/tex.snippets113
2 files changed, 113 insertions, 5 deletions
diff --git a/.config/nvim/my_snippets/latex.snippets b/.config/nvim/my_snippets/latex.snippets
deleted file mode 100644
index fd53f4d..0000000
--- a/.config/nvim/my_snippets/latex.snippets
+++ /dev/null
@@ -1,5 +0,0 @@
1# vim:ft=snippets:
2
3snippet on "O(n)" b
4$\mathcal{O}(n)$
5endsnippet
diff --git a/.config/nvim/my_snippets/tex.snippets b/.config/nvim/my_snippets/tex.snippets
new file mode 100644
index 0000000..ee6e589
--- /dev/null
+++ b/.config/nvim/my_snippets/tex.snippets
@@ -0,0 +1,113 @@
1# vim:ft=snippets:
2 https://castel.dev/post/lecture-notes-1/
3
4snippet template "Basic template" b
5\documentclass[a4paper]{article}
6
7\usepackage[utf8]{inputenc}
8\usepackage[T1]{fontenc}
9\usepackage{textcomp}
10\usepackage{babel}
11\usepackage{amsmath, amssymb}
12
13% figure support
14\usepackage{import}
15\usepackage{xifthen}
16\pdfminorversion=7
17\usepackage{pdfpages}
18\usepackage{transparent}
19\newcommand{\incfig}[1]{%
20 \def\svgwidth{\columnwidth}
21 \import{./figures/}{#1.pdf_tex}
22}
23
24\pdfsuppresswarningpagegroup=1
25
26\begin{document}
27 $0
28\end{document}
29endsnippet
30
31snippet beg "begin{} / end{}" bA
32\\begin{$1}
33 $0
34\\end{$1}
35endsnippet
36
37priority 100
38snippet ... "ldots" iA
39\ldots
40endsnippet
41
42snippet table "Table environment" b
43\begin{table}[${1:htpb}]
44 \centering
45 \caption{${2:caption}}%
46 \label{tab:${3:label}}
47 \begin{tabular}{${5:c}}
48 $0${5/((?<=.)c|l|r)|./(?1: & )/g}
49 \end{tabular}
50\end{table}
51endsnippet
52
53snippet fig "Figure environment" b
54\begin{figure}[${1:htpb}]
55 \centering
56 ${2:\includegraphics[width=0.8\textwidth]{$3}}
57 \caption{${4:$3}}%
58 \label{fig:${5:${3/\W+/-/g}}}
59\end{figure}
60endsnippet
61
62snippet enum "Enumerate" bA
63\begin{enumerate}
64 \item $0
65\end{enumerate}
66endsnippet
67
68snippet item "Itemize" bA
69\begin{itemize}
70 \item $0
71\end{itemize}
72endsnippet
73
74snippet desc "Description" b
75\begin{description}
76 \item[$1] $0
77\end{description}
78endsnippet
79
80snippet on "O(n)" b
81\mathcal{O}(n)
82endsnippet
83
84snippet mk "Math" wA
85$${1}$`!p
86if t[2] and t[2][0] not in [',', '.', '?', '-', ' ']:
87 snip.rv = ' '
88else:
89 snip.rv = ''
90`$2
91endsnippet
92
93snippet dm "Math" wA
94\[
95${1:${VISUAL}}
96.\] $0
97endsnippet
98
99snippet '([A-Za-z])(\d)' "auto subscript" wrA
100`!p snip.rv = match.group(1)`_`!p snip.rv = match.group(2)`
101endsnippet
102
103snippet '([A-Za-z])_(\d\d)' "auto subscript2" wrA
104`!p snip.rv = match.group(1)`_{`!p snip.rv = match.group(2)`}
105endsnippet
106
107snippet // "Fraction" iA
108\\frac{$1}{$2}$0
109endsnippet
110
111snippet '((\d+)|(\d*)(\\)?([A-Za-z]+)((\^|_)(\{\d+\}|\d))*)/' "Fraction" wrA
112\\frac{`!p snip.rv = match.group(1)`}{$1}$0
113endsnippet