News for hackers. Stuff that matters.
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.

There are no comments on this comment yet.