-
Notifications
You must be signed in to change notification settings - Fork 360
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
Errorneous TeX rendering where multiple _
or ^
exist in math expressions
#1389
Comments
Quick note: #1393 will also be resolved if KaTeX does not parse beforehands. |
feel free to improve math support at Markor, and/or Flexmark (Markors markdown parser/converter). Markor is not a Markdown parser/converter. |
These is also a related problem when there are two superscripts in the same paragraph. In the above the top line renders correctly but the second line does not. |
The easiest way would be to just disable the flexmark Superscript extension: markor/app/src/main/java/net/gsantner/markor/format/markdown/MarkdownTextConverter.java Line 111 in 79317e3
After commenting this line, all the examples given so far rendered correctly. Unfortunately, this would reopen #1268. |
Flexmark would parse and corrupt the contents of KaTeX math expressions. This commit circumvents the problem by fencing the math expressions. Fixes gsantner#1389 and gsantner#1393.
…closes #1393, by @fgtham @gsantner (PR #1576) * Fence KaTeX math expressions * Implement flexmark KaTeX extension based on / stripped down flexmark-ext-gitlab * Update markor-markdown-reference template * In addition to `$...$` and `$$...$$`, math rendering can now be enabled with `\(...\)` for inline and `\[...¸]` for display mode. Co-authored-by: Florian Tham <[email protected]> Co-authored-by: Gregor Santner <[email protected]>
General information
Description
An attempt was made to render the following formula:
$\delta ^ {(n)} (at) = \dfrac{1}{|a|} \cdot \dfrac{1}{a ^ n} \delta ^ {(n)} (t)$
But it shows bad results:
Similarly, the following equation will also fail to render properly:
$\left.\mathrm{d}x_1\right|_{x_1=a}$
But has a workaround by adding spaces before and after each underscore, to prevent markdown-like syntax from being rendered first.
References
#952 and #825 are two similar issues about rendering TeX, where a suggestion is provided to use
<div>
to wrap around the markdown block. However, it is a bad practice for markdown writers to use HTML tags within their files. Meanwhile, this issue technically only exist in markor. Because markor is not the only markdown editor I'm currently using, I don't feel necessary to implement this workaround.Guessings
I haven't run into the codes yet, but it's quite apparent that markor is attempting to parse what's wrapped inside the
$...$
, which corrupts the expression before it's sent to KaTeX.I fully understand that it may be part of KaTeX's fault, but I'm a MathJax and KaTeX user, regularly calling them in my own projects without such an error.
The text was updated successfully, but these errors were encountered: