
Show HN: (lax) a pythonic way of writting latex - iogf
https://github.com/iogf/lax
======
Rainymood
>I always found it boring and a pain to write some mathematical formulaes in
latex. Mainly those with a lot of \frac{x}{Y} stuff.

:)

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!

~~~
tmpmov
Thank you for the link to the latex suite. I should have seen this before.

Links for the curious:

[https://sourceforge.net/projects/vim-
latex/](https://sourceforge.net/projects/vim-latex/)

[http://vim-latex.sourceforge.net/](http://vim-latex.sourceforge.net/)

[http://vim-latex.sourceforge.net/documentation/latex-suite-q...](http://vim-
latex.sourceforge.net/documentation/latex-suite-quickstart/lsq-insert-
environment.html)

------
tmpmov
Awesome.

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/s9w/preTeX)
[https://github.com/jobh/latex.py](https://github.com/jobh/latex.py)
[https://github.com/lukasdietrich/untex](https://github.com/lukasdietrich/untex)
[https://github.com/kosmikus/lhs2tex/](https://github.com/kosmikus/lhs2tex/)
(cool example at
[https://github.com/kosmikus/lhs2tex/blob/master/doc/AGExampl...](https://github.com/kosmikus/lhs2tex/blob/master/doc/AGExample.lhs))

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](https://configure.ergodox-
ez.com/layouts/ywYn/latest/0)).

------
kazinator
I suspect you may have some issues:

    
    
      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.

------
fourier_mode
Great tool! An alternative:
[https://docs.sympy.org/latest/tutorial/printing.html](https://docs.sympy.org/latest/tutorial/printing.html)
.

------
snazz
Looks super useful. Have you thought about extending it to write entire LaTeX
documents with this syntax?

