How can I convert a lisp expression to LaTeX math expression.
From simple things like (- 3 2 1)
which should be converted to 3 - 2 - 1
, to relatively complex things like: (* 1 2 (/ 2 3))
⇒ 1 \times 2 \times \frac{2}{3}
, or (somefunc 1 2)
⇒ somefunc(1,2)
, and so on.
Even being able to use some variables instead of numbers and convert them would be nice.
I type Lisp expressions in Emacs a lot, because I can just evaluate that there and get the output. That means I don't have to actually run a calculator or a terminal elsewhere. But I'd like to put valid LaTeX math expressions into the reports, and instead of typing again.
Is there any package that can help with that, or do I have to write the Elisp with a parser myself?
I found https://alejandrogallo.github.io/listex/ which seems to be for writing LaTeX in Lisp. I do not want to write LaTeX in Lisp. I want to convert already written valid Lisp expressions to LaTeX math expressions.
EDIT: Based on the accepted answer I ended up making a whole minor mode centering around this functionality.
Here's the link: https://github.com/Atreyagaurav/litex-mode
elisp
is not about using Elisp to do something. It's about Elisp as a particular Lisp dialect.