From 95686ce8c52cab5d43ec5cc031ce3758589a5f8f Mon Sep 17 00:00:00 2001 From: Nanderty Date: Fri, 19 May 2023 17:08:13 +0200 Subject: graphics --- lua/Snippets/tex/environments.lua | 6 ++-- lua/Snippets/tex/figures.lua | 71 +++++++++++++++++++++++++++++++++++++++ lua/Snippets/tex/greek.lua | 4 +-- lua/Snippets/tex/math.lua | 36 ++++++++++++++++++-- lua/Snippets/tex/symbols.lua | 14 ++++++++ lua/plugins/treesitter.lua | 2 +- 6 files changed, 124 insertions(+), 9 deletions(-) create mode 100644 lua/Snippets/tex/figures.lua (limited to 'lua') diff --git a/lua/Snippets/tex/environments.lua b/lua/Snippets/tex/environments.lua index c4bb38a..f2eb15a 100644 --- a/lua/Snippets/tex/environments.lua +++ b/lua/Snippets/tex/environments.lua @@ -2,7 +2,7 @@ local helper = require('Snippets.luasniphelpers') local helper = require('Snippets.luasniphelpers') return { - -- variable environment + s({ trig = 'beg', snippetType = 'autosnippet' }, fmta( [[ @@ -18,7 +18,7 @@ return { ), { condition = helper.line_begin } ), - -- enumerate environment + s({ trig = 'enu', snippetType = 'autosnippet' }, fmta( [[ @@ -32,7 +32,7 @@ return { ), { condition = helper.line_begin } ), - -- align environment + s({ trig = 'ali', snippetType = 'autosnippet' }, fmta( [[ diff --git a/lua/Snippets/tex/figures.lua b/lua/Snippets/tex/figures.lua new file mode 100644 index 0000000..f95d874 --- /dev/null +++ b/lua/Snippets/tex/figures.lua @@ -0,0 +1,71 @@ +local tex = require('Snippets.luasniphelperslatex') +local helper = require('Snippets.luasniphelpers') + +return { + + s({ trig = 'chfig', snippetType = 'autosnippet' }, + fmta( + [[ +\begin{figure}[h] + \centering + \chemfig { + <> + } + \caption{<>} + \label{fig:<>} +\end{figure} +]], + { + i(1), + i(2), + i(3), + } + ), + { condition = helper.line_begin } + ), + + s({ trig = 'imfig', snippetType = 'autosnippet' }, + fmta( + [[ +\begin{figure}[h] + \centering + \includegraphics + [<>] + {<>} + \caption{<>} + \label{fig:<>} +\end{figure} +]], + { + i(1), + i(2), + i(3), + i(4), + } + ), + { condition = helper.line_begin } + ), + + s({ trig = 'pdfig', snippetType = 'autosnippet' }, + fmta( + [[ +\begin{figure}[h] + \centering + \resizebox + {<>} + {!} + {\input{<>}} + \caption{<>} + \label{fig:<>} +\end{figure} +]], + { + i(1), + i(2), + i(3), + i(4), + } + ), + { condition = helper.line_begin } + ), +} diff --git a/lua/Snippets/tex/greek.lua b/lua/Snippets/tex/greek.lua index 7431adc..b2d076e 100644 --- a/lua/Snippets/tex/greek.lua +++ b/lua/Snippets/tex/greek.lua @@ -131,14 +131,14 @@ return { s({ trig = 'lam', snippetType = 'autosnippet' }, { - t('\\lam '), + t('\\lambda '), }, { condition = tex.in_mathzone } ), s({ trig = 'Lam', snippetType = 'autosnippet' }, { - t('\\Lam '), + t('\\Lambda '), }, { condition = tex.in_mathzone } ), diff --git a/lua/Snippets/tex/math.lua b/lua/Snippets/tex/math.lua index 882231a..47c21a8 100644 --- a/lua/Snippets/tex/math.lua +++ b/lua/Snippets/tex/math.lua @@ -44,6 +44,16 @@ return { { condition = tex.in_mathzone } ), + s({ trig = "lim", snippetType = "autosnippet" }, + fmta( + '\\lim_{<>}', + { + i(1), + } + ), + { condition = tex.in_mathzone } + ), + s({ trig = "int", snippetType = "autosnippet" }, fmta( '\\int_{<>}^{<>}', @@ -150,7 +160,7 @@ return { s({ trig = "sin", snippetType = "autosnippet" }, fmta( - '\\sin{<>}', + '\\sin{(<>)}', { i(1), } @@ -160,7 +170,7 @@ return { s({ trig = "cos", snippetType = "autosnippet" }, fmta( - '\\cos{<>}', + '\\cos{(<>)}', { i(1), } @@ -170,7 +180,27 @@ return { s({ trig = "tan", snippetType = "autosnippet" }, fmta( - '\\tan{<>}', + '\\tan{(<>)}', + { + i(1), + } + ), + { condition = tex.in_mathzone } + ), + + s({ trig = "det", snippetType = "autosnippet" }, + fmta( + '\\det{(<>)}', + { + i(1), + } + ), + { condition = tex.in_mathzone } + ), + + s({ trig = "ln", snippetType = "autosnippet" }, + fmta( + '\\ln{(<>)}', { i(1), } diff --git a/lua/Snippets/tex/symbols.lua b/lua/Snippets/tex/symbols.lua index 76fc3c2..ef57ca4 100644 --- a/lua/Snippets/tex/symbols.lua +++ b/lua/Snippets/tex/symbols.lua @@ -59,10 +59,24 @@ return { { condition = tex.in_mathzone } ), + s({ trig = 'perp', snippetType = 'autosnippet' }, + { + t('\\perp '), + }, + { condition = tex.in_mathzone } + ), + s({ trig = 'Ria', snippetType = 'autosnippet' }, { t('\\Rightarrow '), }, { condition = tex.in_mathzone } ), + + s({ trig = 'to', snippetType = 'autosnippet' }, + { + t('\\to '), + }, + { condition = tex.in_mathzone } + ), } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 4e488ad..ee16f1b 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -10,7 +10,7 @@ return { auto_install = true, ignore_install = { 'latex' }, highlight = { enable = true }, - indent = { enable = true, disable = { 'python' } }, + indent = { enable = true, disable = { 'python' } }, ensure_installed = { 'javascript', 'python', -- cgit v1.2.3