Show HN: (lax) a pythonic way of writting latex
github.com
github.com
:)
This is what keybinds were invented for. I feel really silly for saying this but I made a huge list of custom keybinds only then finding out that the default keybinds in Vim-LaTeX-Suite are super good.
For example
>`/
backtick slash, expands to
>\frac{<++>}{<++>}<++>
where <++> are so called bullets that you can jump to with <C-j>. Another example
>`a
expands to
>\alpha
and all the other letters work as well (`b to \beta, `g to \gamma, etc.). Look into it, it makes typing LaTeX a breeze!
Links for the curious:
https://sourceforge.net/projects/vim-latex/
http://vim-latex.sourceforge.net/
http://vim-latex.sourceforge.net/documentation/latex-suite-q...
I dislike the latex math syntax per the reasons stated in the github article. I also like the idea of being able to output polynomials from a math calculation in python without having to roll my own latex pretty printer (many libraries exist here, but given my infrequent use case I like to keep things as simple as possible).
If I'm honest, I had only thought of intermixing tex with other constructs from the web (e.g. Markdown) and 'lax' gave me the idea to look around. I found a few more tidbits:
https://github.com/s9w/preTeX https://github.com/jobh/latex.py https://github.com/lukasdietrich/untex https://github.com/kosmikus/lhs2tex/ (cool example at https://github.com/kosmikus/lhs2tex/blob/master/doc/AGExampl...)
While I prefer vim and like the bindings, I like to have editor agnostic tools.
For those interested, I currently use pandoc, markdown, and latex -- via vim -- with an Ergodox EZ... (https://configure.ergodox-ez.com/layouts/ywYn/latest/0).
lax -c 'xyz^(alpha(x-2))'
\sqrt[xyz]{alpha(x-2)}
Here, I suspect that alpha is intended to be a single identifier. Yet, TeX will typeset this as a product of the five terms a, l, p, h and a.Note how in the case of sqrt, there is a special control sequence \sqrt and not just a clump of four letters. Without the backslash, it would just be the product term s q r t.
You need something like \text{alpha} or whatever is the correct approach; not sure about this.
But then you have an ambiguity in your source language: why is xyz a product of terms, but alpha a single term.
You might need some notation like \alpha which will mean "the clump of letters which follows is a unit". Your code can decide whether this is something standard like sin, so that \sin can map to \sin, or whether it is nonstandard, requiring treatment like \alpha -> \text{alpha}. Or other ideas: let the user define the symbols, and use "maximal munch": take the longest consecutive sequence of letters that exists as an entry in the user's dictionary of variables and functions.