matlib
matlib copied to clipboard
Eqn parser
I've placed a barebones parser in dev/eqn_parser.R
which implements some of the ideas I was thinking w.r.t. reducing the amount of LaTeX code for the novice user, but still allow power users freedom. The idea is to try and reduce equations such as
Eqn("\\mathcal{H}_0 : \\mathcal{C} \\mathcal{B} & = ")
Eqn("\\mathbf{H}_0 : \\mathbf{C} \\mathbf{B} & = ")
to something analogous to markdown but for LaTeX equations, such as
Eqn("*H*_0 : *C B* & = ")
Eqn("**H**_0 : **C B** & = ")
Of course, the main limitation is that LaTeX has many more environments to choose from, so I've left it possible for users to define what *
and **
should mean in this context, among others. This parser also allows for macro definitions, where for example '*'
will give \\times
and %n
will give the same string that's currently provided by Eqn_newline()
. Other macros starting with %
are easy to add at this point.
There are number of other avenues to go, such as detecting Greek letter inputs to, say, replace beta -> \\beta
to reduce the \\
requirements, but I worry about going too deep here.