# Available for beta testing: Math support in notes

In the latest Zotero beta, it's possible to use LaTeX math right within the Zotero note editor.

The note editor supports both inline and block math nodes. You can insert these by right-clicking on the note and selecting Insert → Math. Zotero will automatically insert an inline node if there's already text on the current line and otherwise create a block node. To trigger via the keyboard, surround inline math with $ (e.g., $2+2$) or type $$ followed by a space to create a block. We're using prosemirror-math and KaTeX under the hood to render the nodes within the note editor. If you export the note, you'll get the regular text with or$$ delimiters, but it's possible to set up KaTeX or MathJax to render those nodes as math with web fonts or SVG. We'll try to write up a documentation page for how to do that before this leaves beta. If you are a math-using person, try it out and let us know how it goes! • This makes me so excited! • edited August 31, 2022 Thank you very much! A few remarks: 1) If the inline math becomes too complicated (multiple lines, exponents, ...), the font quickly becomes too small. In that case, the best solution is probably to switch to a block node. I have tried by adding the$ on each side, but this did not work (ParseError). $should not be allowed in the LaTeX math equation, so it should be possible to interpret the added$ to switch to block equation?
2) Same for splitting the equation in two parts by adding "$$" in the middle of the equation, or " some text ". 3) The block adds vertical spacing above and below when there is text next to it. But the vertical spacing is missing between blocks. I would still prefer keeping the vertical spacing between blocks. The "\\" still gives the ability to keep multiple math lines without vertical spacing if that is really needed. 4) I cannot see the current position (blinking vertical bar) when I try to go between two blocks. 5) Going out of a block (right arrow key) located at the end of the note generates a horizontal blinking bar instead of the vertical one. I am not sure if this is the intended behaviour. 6) If I copy paste a text containing LaTeX equations, it stays as text instead of being converted to a LaTeX equation. Should all the text be interpreted? Or have a way to convert text to Math equation when it is already between . or$$.$$? 7) I would like to convert existing text (not yet containing ) to LaTeX. I have tried to highlight and insert Math, but this simply added the inline Math in front instead of converting the highlighted text. 8) I would expect the "Home" and "End" navigation keys to go to the beginning and the end of the currently edited equation. 9) The inline equation is identified by the pointing finger mouse pointer. It is not consistent for the block equation, sometimes with the vertical bar, sometimes with the arrow. 10) The Math nodes do not seem to work in note headings. 11) In the "Fomat Text" menu ("Aa"), the Math block option is displayed as "noteEditor.mathBlock" and going out of the options window. 12) If I create a block math on the first line of an empty standalone note, then exit, then try to edit again, I cannot see the current position selected anymore. It re-appears if I click on the top and bottom lines "$$". I have seen this also in other block math nodes. It usually recovers after moving around or waiting some times. I could not get precise steps to reproduce for all block math nodes.
13) If I try to move the equation (block math), it automatically enters the editing math mode. I probably do not need to see the raw LaTeX if I just want to move an equation.
14) The "Title" of a note displayed in the central pane only shows the raw text and cannot display math equations.
15) Editing a very long inline equation does not wrap text as for the block equation.
16) Trying to edit a math equation from an older version of Zotero deletes the equation completely.

Thanks again for the new feature!

[Tested on Windows 10, Zotero 6.0.14-beta.2+e474ca524]
• Very nice feature! Happy to see Zotero progressing so much!
• This feature is intended to go eventually into a minor version of Zotero 6? Or it'll wait for Zotero 7?
• 6
• edited 13 days ago
Math in notes is awesome! Thank you @dstillman!

Two questions:
1) Will math notes support be added to the iOS app too?
2) Will math support also be added to annotations?
• We all love the math support in 6.0.14! Thank you Zotero team!
May I ask when will the beta be a formal release?
• This is impressive. I never expected this to happen.
• Any way to add chemical formulas too?
• What do you need for chemical formulas that's not available in math notation?
• I saw on web of some Latex packages (chemfig, ochem, streetex, and xymtex) which allows to display chemical formulas, chemical structures which does not recognized with by Zotero atm. Ex. this simple formula: \ce{ H2O } or \ce{ [Cd\{SC(NH2)2\}2].[Cr(SCN)4(NH3)2]2 }
• I'd be surprised if Zotero implemented specific LaTeX packages. You can already write standard (non-skeletal/structural) chemistry notation using standard markup like $2H + O \longrightarrow H_2O$
• That's great thanks.
• Any way to add chemical formulas too?
Zotero uses prosemirror-math, which is based on KaTeX. There's a chemistry extension for KaTeX, so perhaps it's possible to add support for chemical formulas.

These should be the currently supported functions:
https://katex.org/docs/supported.html
• edited 10 days ago
2) Will math support also be added to annotations?
Seconding this. Many of my annotations involve providing further detail on specific equations, so math support in annotations would be a huge help.
• edited 7 days ago
@warwickmm
I just added support to Mathpix and Bing equation OCR in the Better Notes plugin. Might that be helpful?
• Many thanks to the Zotero team! Dreaming of math support since the first release of Zotero6 and it finally comes true.
• I just added support to Mathpix and Bing equation OCR in the Better Notes plugin. Might that be helpful?
Thanks @hsiangyu_wong. For my use case, having native support for math in annotations would be ideal. I often highlight text and add a comment with lots of math to further explain the highlighted text. Having math support in annotations (as opposed to only in notes) would really enhance the experience of reading a document and being able to easily access additional information in a somewhat "inline" manner.
• edited 7 days ago
@warwickmm
I'm sorry there seems to be no such an 'inline' solution for math in comments currently. The best I can think of is the 'Quick Note' function, provided by the plugin. The first time you click the quick note button on an annotation will parse the markdown format comment and the annotation itself to a new note linked to this annotation. If you click the button again later, the corresponding note will be opened. There you could use the math support in the note.

Not that convenient compared to the possibility to have math in comments natively, but that's what I'm using currently. Just for reference.

One more thing I may be able to help with is that I could add a 'render markdown' button on the annotation to preview the math in a popup. Would that be helpful?
• Thanks for the suggestions, @hsiangyu_wong. Before you spend time on this, I'd be curious to hear what the zotero devs think about supporting math in annotations.

Not sure if it was clear, but it would be nice for the math to be rendered in the iOS app as well. I'm guessing that the plugin approach won't help in this case?
• Annotation comments currently use a much simpler content-editing mechanism that's built in to browsers. Math support would require something closer to the full note editor, which would likely be too slow and memory-intensive — with the sidebar open, it would need to spin up a full instance of the editor for every annotation in view (plus a buffer), which might be 10 or 15 instances, with constant reinitializing as you scrolled. Someone could look into it, but it's probably not realistic.

The iOS app and web library are still using the old note editor from Zotero 5, but they'll be updated to use the new editor in the future and gain math support at that point.
• Thanks dstillman for the insight, much appreciated.
One more thing I may be able to help with is that I could add a 'render markdown' button on the annotation to preview the math in a popup. Would that be helpful?
@hsiangyu_wong, are you suggesting a popup that would render the annotation markdown and math without creating a new note? That sounds intriguing.
• @warwickmm
Yes, exactly what I think. I'll at you once it's ready.
• @dstillman

Happen to find a bug with math in notes. If I copy some rich text and paste it into a math block, like an equation from a website, it will break the math.

https://user-images.githubusercontent.com/33902321/193538796-10a19846-91a9-4e26-a19f-f513db7f4deb.png

Here the 'rightarrow' is pasted.

Thanks!
• Great job! Repect to Zotero team.