Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latex output #6

Closed
s5bug opened this issue Jun 19, 2020 · 10 comments
Closed

Latex output #6

s5bug opened this issue Jun 19, 2020 · 10 comments
Assignees
Labels
Accepted enhancement New feature or request

Comments

@s5bug
Copy link

s5bug commented Jun 19, 2020

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:

  • ASCII (already implemented)
  • utf-8 (already implemented)
  • KaTeX/HTML
  • LaTeX

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
Copy link
Owner

ArthurSonzogni commented Jun 19, 2020

We have several "generator"

  • Mathematic Expression
  • Sequence Diagram
  • Tree
  • Frame
  • Table
  • Planar graph

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
Copy link
Author

s5bug commented Jun 19, 2020

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:

  • Math expressions in the text-based outputs (ascii, utf8)
  • Bibliography support
  • Footnote support
  • Graph/Tree support

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 added a commit that referenced this issue Jun 20, 2020
This addressed issue:
#6
@ArthurSonzogni
Copy link
Owner

ArthurSonzogni commented Jun 20, 2020

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
Copy link
Author

s5bug commented Jun 22, 2020

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:

  • \displaystyle vs inline LaTeX, the former should but \limits on Sums, Integrals, etc I believe (however I am not sure).
  • f(x) = turns into \f{x} =, I'm fairly certain it should be just f\left(x\right) =
  • (expr), even when parentheses are needed, turns into {latexexpr}, instead of \left(latexexpr\right)
  • \cdot for multiplication vs \times
  • \ldots for ellipsis
  • \alpha{}, \Alpha{} instead of the literal symbols

@ArthurSonzogni
Copy link
Owner

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
Copy link
Author

s5bug commented Jun 23, 2020

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 added a commit that referenced this issue Jun 23, 2020
ArthurSonzogni added a commit that referenced this issue Jun 23, 2020
This is related to issue:
#6
ArthurSonzogni added a commit that referenced this issue Jun 23, 2020
This is related to issue:
#6
@ArthurSonzogni ArthurSonzogni added Accepted enhancement New feature or request labels Jun 24, 2020
@ArthurSonzogni ArthurSonzogni changed the title [Question] How easy is it to add backends? Latex output Jun 24, 2020
@ArthurSonzogni ArthurSonzogni self-assigned this Jun 24, 2020
@ArthurSonzogni
Copy link
Owner

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

@s5bug
Copy link
Author

s5bug commented Jun 25, 2020

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
Copy link
Owner

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 added a commit that referenced this issue Jun 28, 2020
@ArthurSonzogni
Copy link
Owner

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

From your list of fixes to do:

  • \displaystyle vs inline LaTeX, the former should but \limits on Sums, Integrals, etc I believe (however I am not sure).
  • f(x) = turns into \f{x} =, I'm fairly certain it should be just f\left(x\right) =
  • (expr), even when parentheses are needed, turns into {latexexpr}, instead of \left(latexexpr\right)
  • \cdot for multiplication vs \times
  • \ldots for ellipsis
  • \alpha{}, \Alpha{} instead of the literal symbols

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants