ArthurSonzogni / Diagon

Interactive ASCII art diagram generators. :star2:
https://arthursonzogni.com/Diagon/
MIT License
1.66k stars 58 forks source link

Latex output #6

Closed s5bug closed 4 years ago

s5bug commented 4 years ago

I'd love to use Diagon in a project I want to make, similar to org-mode but with more modern syntax, output, and tooling. I love how Diagon parses expressions, and so I was wondering how easy it is to add more backends because I don't want to reinvent the wheel. I'm personally looking for:

I've used the latter two a lot, so I'm pretty comfortable with them; if it's not too hard and isn't against the scope of the project I'd love to try and implement them.

ArthurSonzogni commented 4 years ago

We have several "generator"

And the generators have "options", the one in Mathematic Expression are:

- ASCII-only [x]
- Math symbols [x]

I can replace the first one by:

style: [
- unicode
- ascii
- latex
]

I can work on it this weekend, starting with the "Mathematic Expression" generator.

Could you describe a bit more your project? Is this a web based application or are you using the command line application?

I have made some experiment using vim + diagon here: https://youtube.com/watch?v=WTnMft_wvZU

s5bug commented 4 years ago

I would probably bundle the command line application in the document rendering program, or write my thing in C++ and build it with.

I'm tired of org-mode's lack of:

So I've been wanting to write my own thing, and I stumbled across Diagon and the way it parses expressions and has existing utf8 and ascii options makes it a good fit for what I want to do.

ArthurSonzogni commented 4 years ago

I added a "Latex" mode for the mathematic generator. I updated the website: https:/arthursonzogni.com/Diagon

(you will likely have to refresh and/or clear the website disk cache to get the new version)

Does it work the way you expected?

s5bug commented 4 years ago

Sorry for the late response.

It almost works the way I expect. I'm not able to actually test the LaTeX right now, but a few things that worry me:

ArthurSonzogni commented 4 years ago

Thanks for this list! I will submit fixes one by one.

Ideally, I should find a way to build a vizualizer that will build images from latex.

s5bug commented 4 years ago

I forgot to mention, special functions, like log, sin, cos, etc, that should be rendered like this and not like this have a backslash before them. \sin\left(3 + x\right).

As for the visualizer, unless you mean Diagon parsing LaTeX itself, I would recommend KaTeX output at least for the website.

ArthurSonzogni commented 4 years ago

I am going to use MathJax to renderer the latex formula. I am starting to get really nice results.

s5bug commented 4 years ago

KaTeX can statically compile LaTeX into HTML without the need for client-side JS and also doesn't push its own right-click menu, if that's an option.

ArthurSonzogni commented 4 years ago

Katex claims to be faster / smaller, so I will use Katex. Thanks for the suggestion! This will be done likely at the very end of this week.

ArthurSonzogni commented 4 years ago

I updated the website. This should now render the latex formula using katex.

From your list of fixes to do: