tag:support.markedapp.com,2011-09-11:/discussions/problems/160586-issues-with-the-rendering-of-numbered-latex-equationsMarked: Discussion 2020-11-18T19:49:51Ztag:support.markedapp.com,2011-09-11:Comment/488393492020-11-18T15:04:49Z2020-11-18T15:04:49ZIssues with the rendering of numbered latex equations<div><p>Before I start debugging, explain how equation rendering ever works without $$? If there's no delimiter, it shouldn't render as an equation at all. Are you using a custom processor?</p>
<p>Also, have you tested this with both Mathjax and Katex (switch under Style preferences)? Just so I can focus on one or the other, if possible.</p>
<ul>
<li>Brett</li>
</ul></div>Bretttag:support.markedapp.com,2011-09-11:Comment/488393492020-11-18T15:36:02Z2020-11-18T15:36:02ZIssues with the rendering of numbered latex equations<div><p>Hello Brett,<br>
thanks for your quick reply.</p>
<blockquote>
<p>Before I start debugging, explain how equation rendering ever works without $$? If there's no delimiter, it shouldn't render as an equation at all. Are you using a custom processor?</p>
</blockquote>
<p>No idea. It surprised me too. I am not using any custom processor. I am attaching my style and processor preferences and my advanced configuration file for MathJax.</p>
<blockquote>
<p>Also, have you tested this with both Mathjax and Katex (switch under Style preferences)? Just so I can focus on one or the other, if possible.</p>
</blockquote>
<p>I always use Mathjax. But I just tested with Katex: the equation is never rendered. Katex doesn't seem to be able to parse the environment <code>\begin{equation} ... \end{equation}</code> (with or without the enclosing <code>$$</code> signs). As a sanity check, I did however verify that Katex correctly renders the following formula.<br></p>
<pre>
<code>$$
x
$$</code>
</pre>
Please let me know if I can provide any other information.<br>
Thanks a lot for looking into this.<br>
Best,<br>
CJ</div>cjsgtag:support.markedapp.com,2011-09-11:Comment/488393492020-11-18T15:52:38Z2020-11-18T15:52:38ZIssues with the rendering of numbered latex equations<div><p>Ok, I still can't explain why it works without <code>$$</code>, but I can confirm<br>
it does. However, Marked can't do any of it's normal processing without<br>
the delimiter, so if it doesn't break your normal workflow, you'll have<br>
better results over all if you use it.</p>
<p>As far as the equation numbering goes: since version 2.6 Marked has been<br>
doing dynamic updates of the preview, replacing the content in the DOM<br>
without refreshing the view. When there are equations involved, this<br>
means re-parsing the math blocks live every time the new content is<br>
injected. MathJax apparently stores its counter in a persistent way, so<br>
with every render it's assuming it's the equations on the page are new,<br>
and in addition to the ones it's already processed. A hard refresh<br>
(⌘R) will reset the numbering, but there's not much I can do about the incrementing during dynamic refreshes. Is it something you can put up<br>
with, just doing a hard refresh prior to creating output?</p>
<p>Thanks,<br>
Brett</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/488393492020-11-18T19:45:46Z2020-11-18T19:45:46ZIssues with the rendering of numbered latex equations<div><blockquote>
<p>if it doesn't break your normal workflow, you'll have better results over all if you use it [<code>$$</code>].</p>
</blockquote>
<p>Ok. I am fine with that.</p>
<blockquote>
<p>A hard refresh (⌘R) will reset the numbering, but there's not much I can do about the incrementing during dynamic refreshes. Is it something you can put up with, just doing a hard refresh prior to creating output?</p>
</blockquote>
<p>That's good enough for me. Thanks for your help!<br>
For the record: the hard refresh solves all problems listed above, but only when enclosing the equation with <code>$$</code>.</p>
<p><strong>Conclusion: always enclose latex equations with the usual mathjax delimiters (<code>$</code>, <code>$$</code>, ...), and hard refresh (⌘R) if something isn't rendered properly.</strong></p>
<p>Thanks a lot for your help!<br>
Best regards,<br>
CJ</p></div>cjsgtag:support.markedapp.com,2011-09-11:Comment/488393492020-11-18T19:49:50Z2020-11-18T19:49:50ZIssues with the rendering of numbered latex equations<div><p>Happy to help :)</p>
<ul>
<li>Brett</li>
</ul></div>Brett