MicroPad / MicroPad-Core

µPad (MicroPad) is an open digital note taking app
https://getmicropad.com
Mozilla Public License 2.0
235 stars 22 forks source link

LaTex is not rendering when using subscripts in a fraction #245

Closed theDude6 closed 4 years ago

theDude6 commented 4 years ago

Hello!

I'm using LaTex to render equations within my notes. One of the issues is typing an equation like this one - ;;E_r = \frac{L_l}{L_f};; It doesn't render the equation at all. If I remove the subscripts like this - ;;E = \frac{L}{L};; it renders just fine. I have also tried to wrap the subscripts in curly braces and it still will not render. Is this a bug?

NickGeek commented 4 years ago

Hi, Ah, yes that is a bug :-(

What's going on is that _content_ is a way to do italics in markdown, so it's interpreting the content between the two underscores as italicised instead of as two subscripts.

There's already a fix for this with ASCIIMath so I think the same fix would just need to be applied for LaTeX. In the mean time you could use ASCIIMath, where ''E = L_l/L_f'' will render to the same content.

@printfn this might interest you because you were in that area of the codebase recently.

NickGeek commented 4 years ago

If you're interested in doing a fix, the asciimath version of the code is here: https://github.com/MicroPad/MicroPad-Core/blob/master/app/src/app/components/note-viewer/elements/markdown/MarkdownElementComponent.tsx#L341