diff options
Diffstat (limited to '.config/nvim/my_snippets')
-rw-r--r-- | .config/nvim/my_snippets/latex.snippets | 5 | ||||
-rw-r--r-- | .config/nvim/my_snippets/tex.snippets | 113 |
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 | |||
3 | snippet on "O(n)" b | ||
4 | $\mathcal{O}(n)$ | ||
5 | endsnippet | ||
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 | |||
4 | snippet 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} | ||
29 | endsnippet | ||
30 | |||
31 | snippet beg "begin{} / end{}" bA | ||
32 | \\begin{$1} | ||
33 | $0 | ||
34 | \\end{$1} | ||
35 | endsnippet | ||
36 | |||
37 | priority 100 | ||
38 | snippet ... "ldots" iA | ||
39 | \ldots | ||
40 | endsnippet | ||
41 | |||
42 | snippet 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} | ||
51 | endsnippet | ||
52 | |||
53 | snippet 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} | ||
60 | endsnippet | ||
61 | |||
62 | snippet enum "Enumerate" bA | ||
63 | \begin{enumerate} | ||
64 | \item $0 | ||
65 | \end{enumerate} | ||
66 | endsnippet | ||
67 | |||
68 | snippet item "Itemize" bA | ||
69 | \begin{itemize} | ||
70 | \item $0 | ||
71 | \end{itemize} | ||
72 | endsnippet | ||
73 | |||
74 | snippet desc "Description" b | ||
75 | \begin{description} | ||
76 | \item[$1] $0 | ||
77 | \end{description} | ||
78 | endsnippet | ||
79 | |||
80 | snippet on "O(n)" b | ||
81 | \mathcal{O}(n) | ||
82 | endsnippet | ||
83 | |||
84 | snippet mk "Math" wA | ||
85 | $${1}$`!p | ||
86 | if t[2] and t[2][0] not in [',', '.', '?', '-', ' ']: | ||
87 | snip.rv = ' ' | ||
88 | else: | ||
89 | snip.rv = '' | ||
90 | `$2 | ||
91 | endsnippet | ||
92 | |||
93 | snippet dm "Math" wA | ||
94 | \[ | ||
95 | ${1:${VISUAL}} | ||
96 | .\] $0 | ||
97 | endsnippet | ||
98 | |||
99 | snippet '([A-Za-z])(\d)' "auto subscript" wrA | ||
100 | `!p snip.rv = match.group(1)`_`!p snip.rv = match.group(2)` | ||
101 | endsnippet | ||
102 | |||
103 | snippet '([A-Za-z])_(\d\d)' "auto subscript2" wrA | ||
104 | `!p snip.rv = match.group(1)`_{`!p snip.rv = match.group(2)`} | ||
105 | endsnippet | ||
106 | |||
107 | snippet // "Fraction" iA | ||
108 | \\frac{$1}{$2}$0 | ||
109 | endsnippet | ||
110 | |||
111 | snippet '((\d+)|(\d*)(\\)?([A-Za-z]+)((\^|_)(\{\d+\}|\d))*)/' "Fraction" wrA | ||
112 | \\frac{`!p snip.rv = match.group(1)`}{$1}$0 | ||
113 | endsnippet | ||