tag:support.markedapp.com,2011-09-11:/discussions/problems/157132-mathjax-processingMarked: Discussion 2020-04-07T16:42:07Ztag:support.markedapp.com,2011-09-11:Comment/482193342020-04-04T14:59:33Z2020-04-04T14:59:33ZMathJax processing<div><p>Remove your advanced configuration entirely and see what results you<br>
get.</p>
<p>-Brett</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/482193342020-04-04T15:39:17Z2020-04-04T15:39:17ZMathJax processing<div><p>I get more or less what I expect. The single backslashes cause the brackets and parentheses to appear literally, as shown in the attached screenshot. The only things I didn't expect are:</p>
<ol>
<li>
<p>The caret gets interpreted as exponent even when the rest of the equation is treated as regular text. Is that a MulitMarkdown feature I've never used?</p>
</li>
<li>
<p>The italic weirdness in the first two lines of the final paragraph.</p>
</li>
</ol></div>drdrangtag:support.markedapp.com,2011-09-11:Comment/482193342020-04-04T16:06:00Z2020-04-04T16:06:00ZMathJax processing<div><p>Using your settings (with no advanced config) I get this:</p>
<p><img src="http://ckyp.us/Radp3q+" alt=""></p>
<p>MMD processor, AMS_CHTML_full. Are you sure you have Mathjax enabled? And that you have an up-to-date version of Marked?</p>
<p>-Brett</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/482193342020-04-04T16:07:56Z2020-04-04T16:07:56ZMathJax processing<div><p>BTW, yes, the caret does create superscript text, but MMD should be ignoring anything within what it considers math blocks.</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/482193342020-04-05T09:16:59Z2020-04-05T09:16:59ZMathJax processing<div><p>In case that image embed is too small to read, attaching a full size screenshot here. Curious if you've discovered anything on your end to explain the difference?</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/482193342020-04-07T01:49:35Z2020-04-07T01:49:35ZMathJax processing<div><p>I have no explanation. I do have MathJax selected in the Style preference pane (you can see includeMathJax: YES in the configuration section of my first post), and I've relaunched both Marked and Drafts (and rebooted the computer). I've also tried it with the same text in a file.</p>
<p>I get better results using Discount instead of MMD, as you can see in the attached screenshot. Still not right, though.</p>
<p>I'm really surprised to hear that it's rendering for you with and empty Advanced Configuration. Single backslashes in front of parentheses and brackets shouldn't work in a stock MathJax 2 installation, should they?</p></div>drdrangtag:support.markedapp.com,2011-09-11:Comment/482193342020-04-07T01:58:55Z2020-04-07T01:58:55ZMathJax processing<div><p>The base config for Mathjax implements most "standard" configuration options preferred by LaTeX folks, to the best of my knowledge. It's honestly all Greek to me. It also automatically converts $ and $$ delineators for consistency between implementations.</p>
<p>It really appears no Mathjax processing is happening at all for you in MMD mode, which makes me wonder if there's a script error. Could you attach a full sample document to test with?</p>
<ul>
<li>Brett</li>
</ul></div>Bretttag:support.markedapp.com,2011-09-11:Comment/482193342020-04-07T02:13:15Z2020-04-07T02:13:15ZMathJax processing<div><p>Honestly, it's weirder to me that you're getting proper rendering with no advanced configuration than that I'm getting partial rendering with advanced configuration.</p>
<p>I've attached a document, but it's the same text I included inline with my first support email in this thread. I don't mind sending the full blog post, but it's full of image references that clutter up the document and have nothing to do with the math renderin problem.</p>
<p>By the way, you <em>are</em> using MathJax 2 in Marked, aren't you? It's been a while since I wrote a configuration file for that, but I think they still have the docs up for it. When I first wrote you, I thought you might see something obvious and have a quick answer, but if the answer is deep in MathJaxland, I can dig through the docs myself, as long as I know which version of the docs to pull up.</p></div>drdrangtag:support.markedapp.com,2011-09-11:Comment/482193342020-04-07T12:32:39Z2020-04-07T12:32:39ZMathJax processing<div><p>Ok, so using your file I get the results you're getting, whereas my<br>
version with your text copy/pasted in is still rendering fine. Now I<br>
have to look into that mystery. It doesn't appear to be an encoding or<br>
"gremlin" issue of any kind. Have you tried copy/pasting into a new file at all? Not a step I would normally recommend, but something weird is<br>
going on there.</p>
<p>And yes, it's MathJax 2. The implementation of 3 has been too much<br>
effort for few relevant benefits at this point.</p>
<p>-Brett</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/482193342020-04-07T13:24:58Z2020-04-07T13:25:41ZMathJax processing<div><p>Oh, I see. In the email version of the example text that I received for this ticket, all of the surrounding delimiters were double escaped (they are not in the actual code above). In your file, it's all single backslashes. Now I understand your question, I think.</p>
<p>I'm not sure how it works in other systems, but MMD requires that the [] and () surrounding equations be double-backslashed to work. Single backslashes within the equation should work fine, as long as the delimiters are correct. Is that problematic?</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/482193342020-04-07T13:26:13Z2020-04-07T13:26:13ZMathJax processing<div><p>My test file with proper escaping attached.</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/482193342020-04-07T14:37:58Z2020-04-07T14:37:58ZMathJax processing<div><blockquote>
<p>Is that problematic?</p>
</blockquote>
<p>In a word, yes.</p>
<p>As I said in my original email, LaTeX expects single slashes and I have years of habit built in to writing that way, so I set up my blog to handle single slashes, too. I was hoping to do the same with Marked, but it’s looking less likely.</p>
<p>My best bet, assuming I don’t just abandon the idea altogether, might be to write a preprocessor that doubles the appropriate backslashes instead of trying to wrestle with MathJax. I’ll let you know how it works out.</p></div>drdrangtag:support.markedapp.com,2011-09-11:Comment/482193342020-04-07T14:59:26Z2020-04-07T14:59:26ZMathJax processing<div><p>Yes, or setting up PHP MultiMarkdown Extra as a custom processor might told yield results closer to your blog. The issue (I think) is that MMD eats the single escapes before getting to the Mathjax processing.</p>
<ul>
<li>Brett</li>
</ul></div>Bretttag:support.markedapp.com,2011-09-11:Comment/482193342020-04-07T16:31:08Z2020-04-07T16:31:08ZMathJax processing<div><p>Well, just to close this off, I made a one-line Perl preprocessor</p>
<pre>
<code>#!/usr/bin/perl -p
s/([^\\]|^)\\([\[\]\(\)])/$1\\\\$2/g;</code>
</pre>
<p>I know there are situations in which it will fail, but it should be fairly reliable. Regexes get big when every character you care about is a metacharacter.</p>
<p>The problem with my tweaked PHP Markdown Extra is that the one I use for the blog is meant to be used with MathJax 3, and I’m not sure I still have a copy of the version that worked with MathJax 2.</p></div>drdrangtag:support.markedapp.com,2011-09-11:Comment/482193342020-04-07T16:42:06Z2020-04-07T16:42:06ZMathJax processing<div><p>I hope that generally works out. Glad to hear there's a reasonable solution.</p>
<ul>
<li>Brett</li>
</ul></div>Brett