News for hackers. Stuff that matters.
Re:Show HN: (lax) a pythonic way of writting latex by Rainymood on Thursday November 08, 2018 @01:28AM (#18404666)
>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!

Re:Show HN: (lax) a pythonic way of writting latex by tmpmov on Thursday November 08, 2018 @03:18AM (#18404999)
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/

http://vim-latex.sourceforge.net/

http://vim-latex.sourceforge.net/documentation/latex-suite-q...

Re:Show HN: (lax) a pythonic way of writting latex by tmpmov on Thursday November 08, 2018 @03:13AM (#18404984)
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/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).

Re:Show HN: (lax) a pythonic way of writting latex by kazinator on Wednesday November 07, 2018 @08:06PM (#18403653)
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.

Re:Show HN: (lax) a pythonic way of writting latex by fourier_mode on Thursday November 08, 2018 @08:00PM (#18411561)
Re:Show HN: (lax) a pythonic way of writting latex by snazz on Wednesday November 07, 2018 @04:00PM (#18402370)
Looks super useful. Have you thought about extending it to write entire LaTeX documents with this syntax?