refactor(snip): reorder math snippets

This commit is contained in:
arne314
2025-10-29 21:10:57 +01:00
parent a75b85e446
commit e0184b8a4e

View File

@@ -9,7 +9,6 @@ local cap = helper.cap
return { return {
snip('fa', 'forall ', {}, math), snip('fa', 'forall ', {}, math),
snip('ex', 'exists ', {}, math), snip('ex', 'exists ', {}, math),
snip('ni', 'in.not ', {}, math),
snip('Sq', 'square', {}, math), snip('Sq', 'square', {}, math),
-- logical chunks -- logical chunks
@@ -19,6 +18,8 @@ return {
snip('een', 'exists epsilon>>0 ', {}, math), snip('een', 'exists epsilon>>0 ', {}, math),
-- boolean logic -- boolean logic
snip('and', 'and ', {}, math),
snip('or', 'or ', {}, math),
snip('not', 'not ', {}, math), snip('not', 'not ', {}, math),
snip('ip', '==>> ', {}, math), snip('ip', '==>> ', {}, math),
snip('ib', '<<== ', {}, math), snip('ib', '<<== ', {}, math),
@@ -44,7 +45,7 @@ return {
snip('bxx', 'times.square ', {}, math), snip('bxx', 'times.square ', {}, math),
snip('ff', '(<>) / (<>) <>', { i(1, 'a'), i(2, 'b'), i(3) }, math), snip('ff', '(<>) / (<>) <>', { i(1, 'a'), i(2, 'b'), i(3) }, math),
-- exponents -- subscript/superscript
snip('iv', '^(-1) ', {}, math, 500, { wordTrig = false, blacklist = { 'equiv' } }), snip('iv', '^(-1) ', {}, math, 500, { wordTrig = false, blacklist = { 'equiv' } }),
snip('tp', '^top ', {}, math, 500, { wordTrig = false }), snip('tp', '^top ', {}, math, 500, { wordTrig = false }),
snip('cmp', '^complement ', {}, math, 500, { wordTrig = false }), snip('cmp', '^complement ', {}, math, 500, { wordTrig = false }),
@@ -52,10 +53,9 @@ return {
snip('cb', '^3 ', {}, math, 500, { wordTrig = false }), snip('cb', '^3 ', {}, math, 500, { wordTrig = false }),
snip('jj', '_(<>) ', { i(1, 'n') }, math, 500, { wordTrig = false }), snip('jj', '_(<>) ', { i(1, 'n') }, math, 500, { wordTrig = false }),
snip('kk', '^(<>) ', { i(1, 'n') }, math, 500, { wordTrig = false }), snip('kk', '^(<>) ', { i(1, 'n') }, math, 500, { wordTrig = false }),
snip('ep', 'exp(<>) ', { i(1, '1') }, math),
-- sets -- sets
-- 'st' to '{<>} in ./visual.lua -- 'st' to '{<>}' in ./visual.lua
snip('set', '{<> mid(|) <>}', { i(1), i(2) }, math), snip('set', '{<> mid(|) <>}', { i(1), i(2) }, math),
snip('es', 'emptyset ', {}, math), snip('es', 'emptyset ', {}, math),
snip('ses', '{emptyset} ', {}, math), snip('ses', '{emptyset} ', {}, math),
@@ -68,6 +68,7 @@ return {
snip('bnn', 'inter.big ', {}, math), snip('bnn', 'inter.big ', {}, math),
snip('buu', 'union.big ', {}, math), snip('buu', 'union.big ', {}, math),
snip('swo', 'without ', {}, math), snip('swo', 'without ', {}, math),
snip('ni', 'in.not ', {}, math),
-- misc -- misc
snip('to', '->> ', {}, math), snip('to', '->> ', {}, math),
@@ -75,31 +76,37 @@ return {
snip('cp', 'compose ', {}, math), snip('cp', 'compose ', {}, math),
snip('iso', 'tilde.equiv ', {}, math), snip('iso', 'tilde.equiv ', {}, math),
snip('nab', 'nabla ', {}, math), snip('nab', 'nabla ', {}, math),
snip('ep', 'exp(<>) ', { i(1, '1') }, math),
snip('cc', 'cases(\n\t<>\n)\\', { i(1, '1') }, math), snip('cc', 'cases(\n\t<>\n)\\', { i(1, '1') }, math),
snip('([A-Za-z])o([A-Za-z0-9]) ', '<>(<>) ', { cap(1), cap(2) }, math, 100, { snip('([A-Za-z])o([A-Za-z0-9]) ', '<>(<>) ', { cap(1), cap(2) }, math, 100, {
maxTrigLength = 4, maxTrigLength = 4,
blacklist = { 'bot ', 'cos ', 'cot ', 'dot ', 'log ', 'mod ', 'top ', 'won ', 'xor ' }, blacklist = { 'bot ', 'cos ', 'cot ', 'dot ', 'log ', 'mod ', 'not ', 'top ', 'won ', 'xor ' },
}), }),
snip('(K|M|N|Q|R|S|Z)([\\dn]) ', '<><>^<> ', { cap(1), cap(1), cap(2) }, math), snip('(K|M|N|Q|R|S|Z)([\\dn]) ', '<><>^<> ', { cap(1), cap(1), cap(2) }, math),
-- derivatives
snip('dx', 'dif / (dif <>) ', { i(1, 'x') }, math), snip('dx', 'dif / (dif <>) ', { i(1, 'x') }, math),
snip('ddx', '(dif <>) / (dif <>) ', { i(1, 'f'), i(2, 'x') }, math), snip('ddx', '(dif <>) / (dif <>) ', { i(1, 'f'), i(2, 'x') }, math),
snip('DX', 'diff / (diff <>) ', { i(1, 'x') }, math), snip('DX', 'diff / (diff <>) ', { i(1, 'x') }, math),
snip('DDX', '(diff <>) / (diff <>) ', { i(1, 'f'), i(2, 'x') }, math), snip('DDX', '(diff <>) / (diff <>) ', { i(1, 'f'), i(2, 'x') }, math),
snip('part', 'partial ', {}, math, 1600), snip('part', 'partial ', {}, math, 1600),
-- integrals
snip('it', 'integral ', {}, math), snip('it', 'integral ', {}, math),
snip('int', 'integral_(<>)^(<>) ', { i(1, 'a'), i(2, 'b') }, math), snip('int', 'integral_(<>)^(<>) ', { i(1, 'a'), i(2, 'b') }, math),
snip('oit', 'integral.cont_(<>) ', { i(1, 'C') }, math), snip('oit', 'integral.cont_(<>) ', { i(1, 'C') }, math),
snip('dit', 'integral_(<>) ', { i(1, 'Omega') }, math), snip('dit', 'integral_(<>) ', { i(1, 'Omega') }, math),
-- sums
snip('sm', 'sum ', {}, math), snip('sm', 'sum ', {}, math),
snip('sum', 'sum_(<>)^(<>) ', { i(1, 'k=1'), i(2, 'oo') }, math), snip('sum', 'sum_(<>)^(<>) ', { i(1, 'k=1'), i(2, 'oo') }, math),
snip('dsm', 'sum_(<>) ', { i(1, 'Omega') }, math), snip('dsm', 'sum_(<>) ', { i(1, 'Omega') }, math),
-- products
snip('prd', 'product ', {}, math), snip('prd', 'product ', {}, math),
snip('prod', 'product_(<>)^(<>) ', { i(1, 'k=1'), i(2, 'n') }, math), snip('prod', 'product_(<>)^(<>) ', { i(1, 'k=1'), i(2, 'n') }, math),
-- limits
snip('lm', 'lim ', {}, math), snip('lm', 'lim ', {}, math),
snip('lim', 'lim_(<> ->> <>) ', { i(1, 'n'), i(2, 'oo') }, math), snip('lim', 'lim_(<> ->> <>) ', { i(1, 'n'), i(2, 'oo') }, math),
snip('lim (sup|inf)', 'lim<> ', { cap(1) }, math), snip('lim (sup|inf)', 'lim<> ', { cap(1) }, math),