Feature Request for Note: LaTeX math formula support via KaTeX

edited October 13, 2017
In this version Zotero 5.0.22, the Note can not display math formula in LaTeX syntax.
I am wondering if Note can support LaTeX syntax for math formula via KaTeX.

For example, automatically include KaTeX in Note from CDN via:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.9.0-alpha/katex.min.css"; integrity="sha384-FkMHIpkXHDi3o2XSOOa5/9TpXg4AX4DXPSC6z28hi2Eqn/27ea8MTV18rTq9OyQR" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.9.0-alpha/katex.min.js"; integrity="sha384-wt0V9VomB0kx/jgLEkR18Slo+aNALuRwOOrWkicjQ0HHpFqu0JKzaFkbtmsku5a/" crossorigin="anonymous"></script>


Does this possible to be supported in Note?

Many thanks for the great efforts that have been and still being put in developing a better Zotero.
  • Sorry, the discussion does not display the code.

    KaTeX and its usage can be found at: https://github.com/Khan/KaTeX#user-content-usage
  • (You can put code with <code> tags. I've fixed it for you above.)

    If we supported anything, I suspect it would be MathJax, which as I understand it supports a variety of input formats (including LaTeX), not KaTeX.
  • edited October 15, 2017
    > Thanks for your help @dstillman with the display of the code.

    > Here is a performance comparison between render "KaTeX" and "MathJax": https://www.intmath.com/cg5/katex-mathjax-comparison.php
    * It seems that "KaTeX" has a much superior performance than "MathJax".
    * But I do not know if "KaTeX" has a larger support set of LaTeX syntax than "MathJax".

    > I found that note editor is supported via TinyMCE(https://www.tinymce.com/), so I have raised a "feature request" at github project of TinyMCE(https://github.com/tinymce/tinymce/issues/3997) 2 days ago.
    It may contain some information that could be useful, for example, Georg-Git has given a possible solution to make tinymce support LaTeX syntax via "KaTeX".
  • @dstillman, is there any progress on this feature? Because it would really be a great one!

    I tried to integrate the js script mentioned in the github issue raised by @fylimas [http://fiddle.tinymce.com/ncgaab/1] but without success.

    Here is what I did:
    - download the katex support files (.js and .css) and save them inside zotero.jar\resource\tinymce
    - edit zotero.jar\resource\tinymce\note.html (you can see the modified version here: https://pastebin.com/wmNPmMnB - search for katex to locate all the edits)
    - create a note with latex formatted formula:

    <p>Formula inline in text <span class="tinymcekatex" style="background: #eeeeff;">c = \sum_{n=1}^{\infty} \pm \sqrt[3]{(a^2 + b^3)^n}</span> and in display style:</p>
    <p> </p>
    <p><span class="tinymcekatex" style="background: #eeeeff;">c = \displaystyle\sum_{n=1}^{\infty} \pm \sqrt[3]{(a^2 + b^3)^n} + \prod_{i=a}^{b} f(i)</span></p>
    <p> </p>
    <p><span class="tinymcekatex" style="background: #eeeeff;">f(x) = \displaystyle\int_{-\infty}^\infty \hat f(\xi)\,e^{2 \pi i \xi x} \,d\xi + \lim_{h \rightarrow 0 } \frac{f(x+h)-f(x)}{h}</span></p>
    <p> </p>



    But what I did, doesn't work.

    I noticed that the script use a kind of reload strategy so I added the command in the context menu [for simplicity I added it under alignement - and kept the justify icon but this will be improved if there is a solution to make this script works].

    I am not good at .js so I am probably missing something obvious here. Is what I am doing the good way to go to add Latex formatted formula in my zotero note? If not, which direction should I follow? Is there even hope for a latex math formula support?

    Thanks a lot for your help!
  • Any new progress? I want to insert formulas in the notes, but failed. Does anyone know how to do it? Thanks.
  • Unfortunately, nothing new on my side.

    I hope @danstillman or another Zotero developer will be able to help us, because using formulas in notes would really be great!
  • Is there any workaround for at least pasting equations in? I tend to do it with pictures so far
  • edited December 23, 2020
    I found a way to have latex formula in my Zotero notes (not as image but as html). Everything is explained here: https://github.com/MagTun/katex_for_zotero

    @danstillman, that would be great if this katex_for_zotero plugin could be integrated into Zotero core (I created a pull request for this on github).
Sign In or Register to comment.