my current workflow consists of writing my paper in LyX and then copying the formulas to Julia. This is however often prone to errors. Ideally, I would like to copy my equation from Latex directly to Julia. For example, it could look like this
\frac{b}{\sqrt{2\pi\left(1+b^{2}\right)}}
in a simple case. Without having tried yet, it does not seem too difficult to parse this and automatically get the corresponding code in Julia. Before I am having a go at it, I wanted to know if anyone else would be interested or is aware of such a project?
Maybe you can try to use SymPy.jl . There seems to be some latex parsing functionality in sympy, which I assume you can call from SymPy.jl .
Then you could convert the SymPy expression to Julia expression.
You can certainly convert Julia into \LaTeX, there are various packages that support that, including the symbolic package Reduce.jl as well as other packages:
But I am not aware of any full \LaTeX to Julia parsers yet, although I have a VerTeX.jl package which can parse some document level \LaTeX code, but does not currently handle expression level parsing. It would certainly be nice to have a parser which converts those equation expressions into Julia.
Since I do not have a proper idea on how to do it, is there someone who I could talk to, to get a general idea?
My idea so far to build it as an atom-package. You have LaTeX in your clipboard, press for example CTRL+SHIFT+V, then what is in your clipboard is parsed and in combination with the latex-completions package it is turned into Julia code. Would that the general way to go be? Are there any tutorials/sources I should read first?
Generally you would need to implement a LaTeX parser (the most difficult part I guess), map to a Julia AST, which would then be printed for you nicely as Julia code.
I don’t think it is a trivial task — I would recommend either just translating those formulas manually, or, as others have suggested, going in the other direction.