Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
in Q2A Core by

I'm using the MathJax through the method described in the last answer of this post:


It works, but in some cases the latex results are not correctly shown. For example, if I use $$x_i w$$ the result is fine and correct, but if I use $$x_i w_j$$ it will appear as it is (not converted to latex) in the result.

Surprisingly, when I edit the post, the result of $$x_i w_j$$ appears correctly in the preview of the post ! But it still do not appear correctly after saving changes.


I have noticed that html source code of the "previw post" contains $$x_i w_j$$ written correctly (thus it is correctly rendered by MathJax), but the html source code of the "question post" (after posting the question) contains "<p>$$x<em>i w</em>j$$</p>" !! I don't know what <em> is doing here, this may explain why MathJax do not render it correctly !


Changing the editor (from the admin panel) to WYSIWYG or "Simple Editor" instead of the "markdown editor", fixed the problem.

1 Answer

+1 vote
This is a common problem if you use WYSIWYG Editors like CKEditor or TinyMCE.

It looks like plain text $$ tex code $$ but indeed there is hidden HTML behind.

You can fix this by:

A - only using plain text inputs

or B - using a q2a filter plugin, get all the text between $$ and $$ and striptags().

Hope that helps.
Hi. As I indicated in my second edit, using the "WYSIWYG editor" has solved the problem. The problem occurs only with the "markdown editor".