# Commas inside or outside dollars in MathJax?

There are some things which work slightly different in MathJax+html than in standard TeX/LaTeX.

One of the things is that comma or full stop after MathJax might sometimes get on new line - as pointed out by Michael Hardy in this post: A small bug: period on the next line after MathJaX AFAIK this would no happen in LaTeX. Of course, typesetting a document in LaTeX is a different thing than the interplay between HTML and MathJax on a website.

Should we include punctuation between dollars in order to avoid this. For example, is it better to write $x^2=y^2,$ or $x^2=y^2$,? These two variants render as follows $x^2=y^2,$ and a $x^2=y^2$, and if I am lucky enough, I can get comma on the new line.

I will add that in case of centered formulas there is no doubt that the punctuation should be inside dollars, like for example $$x^2=y^2.$$ and not $$x^2=y^2$$. Certainly $$x^2=y^2.$$ looks better than $$x^2=y^2$$.

This is a minor issue, but still from past discussions on meta I know that:

• Some users consider this site as a place where aside from teaching mathematics they also teach LaTeX. And it is not inconceivable that somebody might pick up basics here and they might later start using LaTeX. If they gain some bad habits here, it might be difficult ot get rid of them.
• It was pointed out several times that when using MathJax we should keep also people using screenreaders in mind. However, from this point of view I do not thing that this difference is an issue.
• On the other hand, if this is something which is fixable and might be fixed in the future, it would not be good to use syntax which looks better with the current settings, but is - in some sense - "incorrect".

EDIT: Based on the responses I got so far, I should perhaps clarify that I understand that $x^2=y^2$, is correct and $x^2=y^2,$ is incorrect usage in LaTeX. I am asking on opinions about how to write these things on this site. Whether this is better to follow the same usage as in LaTeX, or whether we should try to make things look as in LaTeX, even if that means different syntax.
• I remember a colleague telling me that one should write $x,y\in Z$ $x,y\in Z$  and $x\in X$, $y\in Y$ $x\in X$, $y\in Y$ because in the first case this is a "mathematical list" and in the second case it is a "text list". This is to say that whether the coma should be between the dollars or not depends on the context/content. – Surb Dec 21 '16 at 16:08