Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Codidact Meta!

Codidact Meta is the meta-discussion site for the Codidact community network and the Codidact software. Whether you have bug reports or feature requests, support questions or rule discussions that touch the whole network – this is the site for you.

How to avoid triggering mathjax?

+4
−0

Apparently, two dollar signs in a paragraph cause the text between them to be interpreted as mathjax. How can this be avoided so that dollar signs can be written literally?

I tried escaping the dollar sign with a "\" before it, and also using the HTML entity "&dollar;". Neither of those worked.

On a more general note, a dollar sign is a questionable choice for triggering alternate syntax, since it's likely to come up in normal text.


After some more experimentation for a paragraph with three dollar signs, I found that the first dollar in a paragraph has to be escaped by two backslashes, the second by one, and the last doesn't need any at all.

It also appear a paragraph needs at least two dollar signs to trigger mathjax.

It would be good to know the actual rules instead of poking around in the dark. I did look at the help on formatting posts and found no mention of mathjax. In fact, there seems to be no real documentation on mathjax at all.

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

2 comment threads

Similar problems described on Codidact Proposals (1 comment)
> On a more general note, a dollar sign is a questionable choice for triggering alternate syntax, sin... (1 comment)

1 answer

+3
−0

The trigger in this case is surrounding text with either

  • $latex$ or \(latex\) for inline math
  • $$latex$$ or \[latex\] for "display math" (centered and on a new line)

The MathJax parser is smart enough to ignore $ when there is only one on the line, which can make it seem inconsistent if you don't know how it works, but it's fairly intuitive if you do know.

However, there are problems due to other formatting that we do. According to the CommonMark Specification which we follow, "Any ASCII punctuation character may be backslash-escaped". This includes $, which is problematic in that it means that we have to escape the escape character:

If you want to type a literal $, it needs to be escaped as \$ so that the MathJax parser ignores it. If you want to type \$, however, it needs to be escaped as \\$ so that the CommonMark parser ignores it.


In regards to help documentation, MathJax is not enabled on every community, so having help documentation on communities that do not have it enabled would be confusing (that being said, the inconsistency between communities can also be quite confusing). For communities that do have MathJax enabled, there should be documentation. Take a look at Math's help for instance.

If you find a community with MathJax but without that help section, please raise an issue.

History
Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

help (2 comments)

Sign up to answer this question »