Separate metavar font
It would be nice to be able to format metavariables differently than constants and other parts of the language.
For example: λ x : τ . if e then e₁ else e₂
Right now, mttex accepts two fonts for each language: a font, and a symbol font. Probably, it should accept many more. (Perhaps similar to Redex?):
- keyword font (lambda, let, forall, etc)
- literal font (1, 2, Set, Prop)
- metavar font (e, t, x)
- symbol font (:, ., ->, ,, parens)
This will be backward incompatible, in a major way. And any future changes to this interface will be. It's worth looking at LaTeX packages that add keyword arguments/dictionaries, and replacing the formatting macro arguments with a single dictionary. Then all future additions will be backward compatible.
@nrioux, I'm a bit swamped and may not get around to this for a while. If you want to help, here's a quick TODO list.
- [ ] Modify
\newmetavarStar(https://github.com/wilbowma/mttex/blob/master/mttex.sty#L559) to accept new formatting macros and insert them in the right places. Should be simple, since it currently inserts the language font, and instead should insert the metavar font. - [ ] Modify
\newmetavarNoStar(https://github.com/wilbowma/mttex/blob/master/mttex.sty#L646) to accept new formatting macros and thread them through. - [ ] Modify
\newmetavarsS(https://github.com/wilbowma/mttex/blob/master/mttex.sty#L684) to accept new formatting macros and thread them through. - [ ] Modify
\newmetavars(https://github.com/wilbowma/mttex/blob/master/mttex.sty#L708) to accept new formatting macros and thread them through. - [ ] Modify
\newlanguage(https://github.com/wilbowma/mttex/blob/master/mttex.sty#L1480) to accept new formatting macros and call helpers with the right macros. - [ ] Modify library of types and expressions (https://github.com/wilbowma/mttex/blob/master/mttex.sty#L770) to accept and use new formatting macros.
@nrioux, as workaround for now, you can give \newlanguage an empty list of metavariables and use \newmetavars afterwards manually:
\newcommand{\sfontit}[1]{\sfont{\mathit{#1}}}
\newcommand{\sfontcal}[1]{\scolor{\mathcal{#1}}}
\newmetavars{\sfontit}{\scolor}{s}{e,A,B,i,x,y}
\newmetavars{\sfontcal}{\scolor}{s}{U}
Related to #29