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 support #529

Closed
Netsaver opened this issue Mar 2, 2017 · 8 comments
Closed

Latex support #529

Netsaver opened this issue Mar 2, 2017 · 8 comments

Comments

@Netsaver
Copy link

Netsaver commented Mar 2, 2017

Hi,
I write Markdown + Latex notes.
I appreciate the capability to generate images from latex code, but images are not ideal for maintainability.
What if I want to change the equations later?
The de-facto standard for latex support in light-weight markup documents foresees the use of $ delimiters for inline latex code and $$ delimiters for block code, e.g.

markdown text $ latex inline code $ markdown text,or
$$ latex block code $$
other markdown text.

Usually, I prefer adding {} (which are allowed latex delimiters) in order to have asymmetrical delimiters which can be automatically managed, e.g.

markdown text ${ latex inline code }$ markdown text,or
$${ latex block code }$$
other markdown text.

So the point is keeping latex code inside markup documents and possibly having a preview.
Now if I understand, the preview is not browser based, so is not possible to use javascript (e.g. mathjax library) for math preview (on-the-fly latex to img conversion).
Anyway it should be possible to add a step further to the current QML mechanism:

var html = script.downloadUrlToMedia("http://latex.codecogs.com/gif.latex?\frac{1}{1+sin(x)}");

The parser (I think before markdown parser, but also after it should have the same effect) could
retrive all latex code between $$ delimiters and pass it to the QML instruction:
$$ latex 1 $$ or $${ latex 1 }$$ -->(parser) string1 = "latex 1" --> var html1 = script.downloadUrlToMedia("http://latex.codecogs.com/gif.latex?"+string1);
this would allow to keep the source code with latex embedded.
Also consider that markdown + latex code could be converted automatically towards other formats with the famous pandoc converter.
What do you think about?

Thanks and regards,
Netsaver, Rome

@pbek
Copy link
Owner

pbek commented Mar 2, 2017

Thank you for your suggestions, but I think I don't really understand what exactly are you suggesting. Integrating pandoc support into QON?

@pbek
Copy link
Owner

pbek commented Mar 6, 2017

I will close this issue until there is more information.

@pbek pbek closed this as completed Mar 12, 2017
@RoyiAvital
Copy link

I think he asks for MathJax support.
Namely ability to us LaTeX for math in MarkDown.

You can see how it is done in StackEdit for example using $ <LaTeX Code> $.

Adding MathJax Support for MarkDown is easy and would benefit many.

@pbek
Copy link
Owner

pbek commented Jun 2, 2017

MathJax is a javascript library, we don't have a webbrowser to use it. Please see #377 and #400.

@pbek pbek added the Duplicate label Jun 2, 2017
@r00tr4v3n
Copy link
Contributor

You might want to check out the latex-math script.

@RoyiAvital
Copy link

RoyiAvital commented May 10, 2020

@r00tr4v3n , Could you elaborate?

MathJax is a javascript library, we don't have a webbrowser to use it. Please see #377 and #400.

@pbek , You can easily embed it or enable it only when Internet connection is available.

@r00tr4v3n
Copy link
Contributor

r00tr4v3n commented May 10, 2020

@r00tr4v3n , Could you elaborate?

I released a new script in the repository. Install it in addition to KLatexFormula and test if simple formulas are enough for your use case. e. g. $ \sqrt{e^3} $

pbek means there is no browser widget to run the library. The preview supports only an html subset. If you just want to generate stuff and then display the images, you can do that via scripts with online services as pbek's paste Latex script or offline like my KLatexFormula script.

@yunesj
Copy link

yunesj commented Jul 9, 2020

Maybe @Netsaver was converting latex to images via the Paste Latex Image script without deselecting the copied latex, which would have the result of replacing the latex text with the latex image.

The script is good and versatile if you realize it pastes from the clipboard rather than the selection, and remember to deselect first!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants