2023-12-02 00:46:56 +01:00
|
|
|
local A = require("my.abbreviations")
|
|
|
|
local scrap = require("scrap")
|
|
|
|
local M = {}
|
|
|
|
|
2024-01-28 16:00:03 +01:00
|
|
|
local function nocap(d)
|
|
|
|
d.options = A.no_capitalization
|
|
|
|
return d
|
|
|
|
end
|
|
|
|
|
2023-12-02 00:46:56 +01:00
|
|
|
M.words = {
|
|
|
|
-- {{{ General phrases
|
2024-01-28 16:00:03 +01:00
|
|
|
{ "thrf", "therefore" },
|
|
|
|
{ "bcla", "by contradiction let's assume" },
|
|
|
|
{ "wlg", "without loss of generality" },
|
|
|
|
{ "tits", "that is to say," },
|
|
|
|
{ "wpbd", "we will prove the statement in both directions." },
|
|
|
|
{ "stam{,s}", "statement{}" },
|
2023-12-02 00:46:56 +01:00
|
|
|
{ "{ww,tt}{m,i}", "{which,this} {means,implies}" },
|
2024-01-28 16:00:03 +01:00
|
|
|
{ "cex{,s}", "counterexample{}" },
|
|
|
|
{ "er{t,s,r}", "{transitivity,symmetry,reflexivity}" },
|
2023-12-02 00:46:56 +01:00
|
|
|
-- }}}
|
|
|
|
-- {{{ Special chars
|
|
|
|
-- System for writing special characters which need to also be easly
|
|
|
|
-- accessible as {sub/super}scripts.
|
|
|
|
--
|
|
|
|
-- The reason epsilon and lambda are separated out from everything else in
|
|
|
|
-- the pattern is because they are the only ones where `foo` doesn't expand
|
|
|
|
-- to `\\foo` directly (so I saved some keystrokes by letting scrap.nvim
|
|
|
|
-- repeat everything for me).
|
|
|
|
{
|
|
|
|
"{,e,s}{{eps,lam},{star,delta,Delta,pi,tau,psi,phi,rho,sigma,alpha,beta,theta,gamma,omega,Omega}}",
|
|
|
|
"{,^,_}\\\\{{epsilon,lambda},{}}",
|
|
|
|
options = A.no_capitalization,
|
|
|
|
},
|
|
|
|
-- }}}
|
|
|
|
-- {{{ Set symbols
|
|
|
|
-- - nats => naturals
|
|
|
|
-- - ints => integers
|
|
|
|
-- - rats => rationals
|
|
|
|
-- - irats => irationals
|
|
|
|
-- - rrea => reals
|
|
|
|
-- - comp => complex
|
|
|
|
-- - ppri => primes
|
|
|
|
-- - ffie => fields
|
|
|
|
{
|
|
|
|
"{nats,ints,rats,irats,rrea,comp,ppri,ffie}",
|
|
|
|
"\\mathbb\\{{N,Z,Q,I,R,C,P,F}\\}",
|
|
|
|
options = A.no_capitalization,
|
|
|
|
},
|
|
|
|
-- }}}
|
|
|
|
-- {{{ Calculus & analysis
|
2024-01-28 16:00:03 +01:00
|
|
|
{ "ib{p,s}", "integration by {parts,substitution}" },
|
|
|
|
{ "{o,c,}nb{,h}{,s}", "{open,closed,} neighbour{,hood}{}" },
|
|
|
|
{
|
|
|
|
"{n,}{{c,}d,iv,it}ble",
|
|
|
|
"{non-,}{{continuously,} differentia,inverti,integra}ble",
|
|
|
|
},
|
|
|
|
nocap({ "lshiz{c,}", "Lipschitz{ condition,}" }),
|
2023-12-02 00:46:56 +01:00
|
|
|
-- }}}
|
|
|
|
-- {{{ Linear algebra
|
2024-01-28 16:00:03 +01:00
|
|
|
{ "rref", "reduced row echalon form" },
|
2023-12-02 00:46:56 +01:00
|
|
|
{ "eg{va,ve,p}{,s}", "eigen{value,vector,pair}{}" },
|
2024-01-28 16:00:03 +01:00
|
|
|
{ "mx{,s}", "matri{x,ces}" },
|
|
|
|
{ "dete{,s}", "determinant{}" },
|
|
|
|
{ "ort{n,g}", "orto{normal,gonal}" },
|
|
|
|
{ "l{in,de}", "linearly {independent,dependent}" },
|
|
|
|
{ "lcon{,s}", "linear combination{}" },
|
|
|
|
{ "vst{,s}", "vector space{}" }, -- text vector space
|
|
|
|
nocap({ "rizz", "Riesz vector" }), -- 💀
|
2023-12-02 00:46:56 +01:00
|
|
|
-- }}}
|
|
|
|
-- {{{ Differential equations
|
|
|
|
-- Note: we must add the space inside the {} in order for capitalization to work!
|
|
|
|
{
|
|
|
|
"{{s,o,l},}deq{s,}",
|
|
|
|
"{{scalar,ordinary,linear} ,}differential equation{}",
|
|
|
|
},
|
|
|
|
-- }}}
|
|
|
|
-- {{{ Graph theory
|
2024-01-28 16:00:03 +01:00
|
|
|
{ "vx{,s}", "vert{ex,ices}" },
|
2023-12-02 00:46:56 +01:00
|
|
|
{ "edg{,s}", "edge{}" },
|
|
|
|
-- }}}
|
|
|
|
}
|
|
|
|
|
|
|
|
M.notation = {
|
|
|
|
-- {{{ Exponents and subscripts:
|
|
|
|
-- {operation}{argument}
|
|
|
|
-- - operation = e (exponent) | s (subscript)
|
|
|
|
-- - argument = t{special} | {basic}
|
|
|
|
-- - basic = 0-9|n|i|t|k
|
|
|
|
-- - special =
|
|
|
|
-- - "p" => +
|
|
|
|
-- - "m" => -
|
|
|
|
-- - "i" => -1
|
|
|
|
{
|
2024-01-28 16:00:03 +01:00
|
|
|
"{e,s}{{0,1,2,3,4,5,6,7,8,9,n,i,t,k,m},t{i,m,p}}",
|
2023-12-02 00:46:56 +01:00
|
|
|
"{^,_}{{},{\\{-1\\},-,+}}",
|
|
|
|
},
|
|
|
|
-- }}}
|
|
|
|
}
|
|
|
|
|
|
|
|
function M.setup()
|
|
|
|
A.manyGlobalAbbr(scrap.expand_many(M.words))
|
|
|
|
A.manyGlobalAbbr(scrap.expand_many(M.notation, { capitalized = false }))
|
|
|
|
end
|
|
|
|
|
|
|
|
return M
|