From 3c6845fdbc5f3448d2f99e444fed1c8758845866 Mon Sep 17 00:00:00 2001 From: Nanderty Date: Thu, 12 Oct 2023 22:25:33 +0200 Subject: Snippet improvements chemistry --- lua/Snippets/tex/schemes.lua | 210 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 lua/Snippets/tex/schemes.lua (limited to 'lua/Snippets/tex/schemes.lua') diff --git a/lua/Snippets/tex/schemes.lua b/lua/Snippets/tex/schemes.lua new file mode 100644 index 0000000..fcb6579 --- /dev/null +++ b/lua/Snippets/tex/schemes.lua @@ -0,0 +1,210 @@ +local tex = require('Snippets.luasniphelperslatex') +local helper = require('Snippets.luasniphelpers') + +return { + s({ trig = 'chfig', snippetType = 'autosnippet' }, + fmta( + [[ +\begin{scheme}[!h] + \centering + \chemfig { + <> + } + \caption{<> + } + \label{sch:<>} +\end{scheme} +]], + { + i(1), + i(2), + i(3), + } + ), + { condition = helper.line_begin } + ), + + s({ trig = 'chsch', snippetType = 'autosnippet' }, + fmta( + [[ +\begin{scheme}[!h] + \centering + \schemestart + \chemfig { + <> + } + \schemestop + \caption{<> + } + \label{sch:<>} +\end{scheme} +]], + { + i(1), + i(2), + i(3), + } + ), + { condition = helper.line_begin } + ), + + s({ trig = 'scm', snippetType = 'autosnippet' }, + fmta( + [[ +\schemestart +<> +\schemestop +]], + { + i(1), + } + ), + { condition = tex.in_scheme } + ), + + s({ trig = 'ssc', snippetType = 'autosnippet' }, + fmta( + [[ +\subscheme { + <> +} +]], + { + i(1), + } + ), + { condition = tex.in_scheme } + ), + + s({ trig = 'chf', snippetType = 'autosnippet' }, + fmta( + [[ +\chemfig { + <> +} + ]], + { + i(1), + } + ), + { condition = tex.in_scheme } + ), + + s({ trig = 'arr', snippetType = 'autosnippet' }, + fmta( + '\\arrow(<>){<>}[<>]', + { + i(1), + i(2), + i(3), + } + ), + { condition = tex.in_scheme } + ), + + s({ trig = 'move', snippetType = 'autosnippet' }, + fmta( + [[ +\chemmove[shorten <<=<>,shorten >>=<>]{ + \draw(<>).. controls +(<>) and +(<>).. (<>); +} + ]], + { + i(1), + i(2), + i(3), + i(4), + i(5), + i(6), + } + ), + { condition = tex.in_scheme } + ), + + s({ trig = 'chr', snippetType = 'autosnippet' }, + fmta( + '\\charge{<>}{<>}', + { + i(1), + i(2), + } + ), + { condition = tex.in_scheme } + ), + + s({ trig = 'brc', snippetType = 'autosnippet' }, + fmta( + [[ +\polymerdelim[height = <>, depth = <>, + open xshift=<>, close xshift=<>, + indice = \!\!<>] + {op<>}{cl<>} +]], + { + i(1), + i(2), + i(3), + i(4), + i(5), + i(6), + i(7), + } + ), + { condition = tex.in_scheme } + ), + + s({ trig = 'nme', snippetType = 'autosnippet' }, + fmta( + [[ +\chemname{ + <> +}{<>} +]], + { + i(1), + i(2), + } + ), + { condition = tex.in_scheme } + ), + + s({ trig = 'omi', snippetType = 'autosnippet' }, + { t('\\ominus') }, + { condition = tex.in_scheme } + ), + + s({ trig = 'rfr', snippetType = 'autosnippet' }, + fmta( + [[ \ref{fig:<>}]], + { + i(1), + } + ) + ), + + s({ trig = 'opl', snippetType = 'autosnippet' }, + { t('\\oplus') }, + { condition = tex.in_scheme } + ), + + s({ trig = 'crp', snippetType = 'autosnippet' }, + fmta( + [[(-[::<>,0.4,,,draw=none]\oplus)]], + { + i(1), + } + ), + { condition = tex.in_scheme } + ), + + s({ trig = 'crm', snippetType = 'autosnippet' }, + fmta( + [[(-[::<>,0.4,,,draw=none]\ominus)]], + { + i(1), + } + ), + { condition = tex.in_scheme } + ), + +} -- cgit v1.2.3