1
Fork 0

Add some extra latex abbreviations

This commit is contained in:
Matei Adriel 2023-09-19 15:07:18 +03:00
parent 0ca50395eb
commit 9ef93664e2
No known key found for this signature in database

View file

@ -32,7 +32,7 @@ vim.opt.foldmethod = "expr"
-- }}} -- }}}
local abbreviations = { local abbreviations = {
-- Greek chars -- {{{ Greek chars
{ "eps", "\\epsilon" }, { "eps", "\\epsilon" },
{ "delta", "\\delta" }, { "delta", "\\delta" },
{ "Delta", "\\Delta" }, { "Delta", "\\Delta" },
@ -47,7 +47,7 @@ local abbreviations = {
{ "omega", "\\omega" }, { "omega", "\\omega" },
{ "Omega", "\\Omega" }, { "Omega", "\\Omega" },
{ "nuls", "\\varnothing" }, { "nuls", "\\varnothing" },
-- }}}
-- Other fancy symvols -- Other fancy symvols
{ "tmat", "^T" }, -- Tranpose of a matrix { "tmat", "^T" }, -- Tranpose of a matrix
{ "cmat", "^*" }, -- Conjugate of a matrix { "cmat", "^*" }, -- Conjugate of a matrix
@ -58,7 +58,6 @@ local abbreviations = {
-- Basic commands -- Basic commands
{ "mangle", "\\measuredangle" }, { "mangle", "\\measuredangle" },
{ "aangle", "\\angle" }, { "aangle", "\\angle" },
{ "sdiff", "\\setminus" }, { "sdiff", "\\setminus" },
{ "sst", "\\subset" }, { "sst", "\\subset" },
{ "spt", "\\supset" }, { "spt", "\\supset" },
@ -67,8 +66,6 @@ local abbreviations = {
{ "nin", "\\not\\in" }, { "nin", "\\not\\in" },
{ "iin", "\\in" }, { "iin", "\\in" },
{ "tto", "\\to" }, { "tto", "\\to" },
{ "iip", "\\implies" },
{ "iib", "\\impliedby" },
{ "land", "\\land" }, { "land", "\\land" },
{ "lor", "\\lor" }, { "lor", "\\lor" },
{ "ssin", "\\sin" }, { "ssin", "\\sin" },
@ -102,12 +99,15 @@ local abbreviations = {
{ "prob", "\\prob" }, -- custom probability function { "prob", "\\prob" }, -- custom probability function
{ "dist", "\\dist" }, -- custom dist function { "dist", "\\dist" }, -- custom dist function
{ "diam", "\\diam" }, -- custom diam operator { "diam", "\\diam" }, -- custom diam operator
{ "gen", "\\gen" }, -- custom command for group generated by element
{ "ord", "\\ordop" }, -- order of a group
{ "vsm", "\\vecspace" }, -- custom math vector space
} }
-- Todo: convert exponents and subscripts -- Todo: convert exponents and subscripts
-- to use this more concise notation. -- to use this more concise notation.
local abolishAbbreviations = { local abolishAbbreviations = {
-- General phrases -- {{{ General phrases
{ "thrf", "therefore" }, { "thrf", "therefore" },
{ "bcla", "by contradiction let's assume" }, { "bcla", "by contradiction let's assume" },
{ "wlg", "without loss of generality" }, { "wlg", "without loss of generality" },
@ -117,12 +117,12 @@ local abolishAbbreviations = {
{ "{ww,tt}{m,i}", "{which,this} {means,implies}" }, { "{ww,tt}{m,i}", "{which,this} {means,implies}" },
{ "cex{,s}", "counterexample{}" }, { "cex{,s}", "counterexample{}" },
{ "er{t,s,r}", "{transitivity,symmetry,reflexivity}" }, { "er{t,s,r}", "{transitivity,symmetry,reflexivity}" },
-- }}}
-- Calculus & analysis -- {{{ Calculus & analysis
{ "ib{p,s}", "integration by {parts,substitution}" }, { "ib{p,s}", "integration by {parts,substitution}" },
{ "nb{,h}{,s}", "neighbour{,hood}{}" }, { "nb{,h}{,s}", "neighbour{,hood}{}" },
-- }}}
-- Linear algebra -- {{{ Linear algebra
{ "rref", "reduced row echalon form" }, { "rref", "reduced row echalon form" },
{ "eg{va,ve,p}{,s}", "eigen{value,vector,pair}{}" }, { "eg{va,ve,p}{,s}", "eigen{value,vector,pair}{}" },
{ "mx{,s}", "matri{x,ces}" }, { "mx{,s}", "matri{x,ces}" },
@ -130,24 +130,23 @@ local abolishAbbreviations = {
{ "ort{n,g}", "orto{normal,gonal}" }, { "ort{n,g}", "orto{normal,gonal}" },
{ "l{in,de}", "linearly {independent,dependent}" }, { "l{in,de}", "linearly {independent,dependent}" },
{ "lcon{,s}", "linear combination{}" }, { "lcon{,s}", "linear combination{}" },
{ "vsm", "\\vecspace" }, -- math vector space { "vst{,s}", "vector space{}" }, -- text vector space
{ "vst{,s}", "vector space{,s}" }, -- text vector space
{ {
"rizz", -- ok please ignore this one 💀 "rizz", -- ok please ignore this one 💀
"Riesz vector", "Riesz vector",
options = A.no_capitalization, options = A.no_capitalization,
}, },
-- }}}
-- Graph theory -- {{{ Linear systems
{ "vx{,s}", "vert{ex,ices}" },
{ "edg{,s}", "edge{}" },
-- Linear systems
-- Note: we must add the space inside the {} in order for capitalization to work! -- Note: we must add the space inside the {} in order for capitalization to work!
{ {
"{{s,o,l},}deq{s,}", "{{s,o,l},}deq{s,}",
"{{scalar,ordinary,linear} ,}differential equation{}", "{{scalar,ordinary,linear} ,}differential equation{}",
}, },
-- }}}
-- {{{ Graph theory
{ "vx{,s}", "vert{ex,ices}" },
{ "edg{,s}", "edge{}" },
-- Graph theory function syntax: -- Graph theory function syntax:
-- gt[function]{graph}{modifier} -- gt[function]{graph}{modifier}
@ -175,19 +174,19 @@ local abolishAbbreviations = {
"{{},\\kappa,\\alpha,\\omega,\\Delta,\\delta{,'},\\chi{,'}{,_l}}({G,S,H,X,Y}{,',_1,_2})", "{{},\\kappa,\\alpha,\\omega,\\Delta,\\delta{,'},\\chi{,'}{,_l}}({G,S,H,X,Y}{,',_1,_2})",
options = A.no_capitalization, options = A.no_capitalization,
}, },
-- }}}
-- My own operator syntax: -- {{{ My own operator syntax:
-- - Any operator can be prefixed with "a" to -- - Any operator can be prefixed with "a" to
-- align in aligned mode -- align in aligned mode
-- - Any operator can be prefixed with cr to -- - Any operator can be prefixed with cr to
-- start a new line and align in aligned mode -- start a new line and align in aligned mode
{ {
"{cr,a,}{eq,neq,leq,geq,lt,gt,iff}", "{cr,a,}{eq,neq,leq,geq,lt,gt,iff,iip,iib}",
"{\\\\\\&,&,}{=,\\neq,\\leq,\\geq,<,>,\\iff}", "{\\\\\\&,&,}{=,\\neq,\\leq,\\geq,<,>,\\iff,\\implies,\\impliedby}",
options = A.no_capitalization, options = A.no_capitalization,
}, },
-- }}}
-- Exponents and subscripts: -- {{{ Exponents and subscripts:
-- {operation}{argument} -- {operation}{argument}
-- - operation = e (exponent) | s (subscript) -- - operation = e (exponent) | s (subscript)
-- - argument = t{special} | {basic} -- - argument = t{special} | {basic}
@ -201,8 +200,8 @@ local abolishAbbreviations = {
"{^,_}{{},{\\{-1\\},-,+}}", "{^,_}{{},{\\{-1\\},-,+}}",
options = A.no_capitalization, options = A.no_capitalization,
}, },
-- }}}
-- Set symbols -- {{{ Set symbols
-- - nats => naturals -- - nats => naturals
-- - ints => integers -- - ints => integers
-- - rats => rationals -- - rats => rationals
@ -216,8 +215,8 @@ local abolishAbbreviations = {
"\\mathbb\\{{N,Z,Q,I,R,C,P,F}\\}", "\\mathbb\\{{N,Z,Q,I,R,C,P,F}\\}",
options = A.no_capitalization, options = A.no_capitalization,
}, },
-- }}}
-- Function calls: -- {{{ General function calls:
-- {function-name}{modifier?}{argument}{argument-modifier?} -- {function-name}{modifier?}{argument}{argument-modifier?}
-- --
-- - function-name = f/g/h/P -- - function-name = f/g/h/P
@ -233,13 +232,23 @@ local abolishAbbreviations = {
"{f,g,h,P}{d,2,3,i,}{x,y,z,a,t,i,n,k}{n,}", "{f,g,h,P}{d,2,3,i,}{x,y,z,a,t,i,n,k}{n,}",
"{}{',^2,^3,^\\{-1\\},}({}{_n,})", "{}{',^2,^3,^\\{-1\\},}({}{_n,})",
}, },
-- }}}
} }
local expanded = scrap.expand_many(abolishAbbreviations) local expanded = scrap.expand_many(abolishAbbreviations)
-- Last I checked this contained 1166 abbreviations -- Last I checked this contained 1179 abbreviations
-- print(#abbreviations + #expanded) -- print(#abbreviations + #expanded)
local all = ""
for _, v in pairs(abbreviations) do
all = all .. v[1] .. " " .. v[2] .. "\n"
end
for _, v in pairs(expanded) do
all = all .. v[1] .. " " .. v[2] .. "\n"
end
print(all)
A.manyLocalAbbr(abbreviations) A.manyLocalAbbr(abbreviations)
A.manyLocalAbbr(expanded) A.manyLocalAbbr(expanded)