# Strange behaviour of text following immediately long MathJax expression

I have noticed this behavior in this post. Here is an example:
$|s_nt_n - st| = |s_nt_n - s_nt + s_nt -st| \le |s_nt_n - s_nt| + |s_nt - st| = |s_n|*|t_n - t| + |t|*|s_n -s|$.
It behaves the same way if the comma is replaced by some actual text (since the comments indicated different behavior for different uesr, I've added several samples with various lengths of the word immediately following the formula):
$|s_nt_n - st| = |s_nt_n - s_nt + s_nt -st| \le |s_nt_n - s_nt| + |s_nt - st| = |s_n|*|t_n - t| + |t|*|s_n -s|$ test
$|s_nt_n - st| = |s_nt_n - s_nt + s_nt -st| \le |s_nt_n - s_nt| + |s_nt - st| = |s_n|*|t_n - t| + |t|*|s_n -s|$ tes
$|s_nt_n - st| = |s_nt_n - s_nt + s_nt -st| \le |s_nt_n - s_nt| + |s_nt - st| = |s_n|*|t_n - t| + |t|*|s_n -s|$ te
$|s_nt_n - st| = |s_nt_n - s_nt + s_nt -st| \le |s_nt_n - s_nt| + |s_nt - st| = |s_n|*|t_n - t| + |t|*|s_n -s|$ t
$|s_nt_n - st| = |s_nt_n - s_nt + s_nt -st| \le |s_nt_n - s_nt| + |s_nt - st| = |s_n|*|t_n - t| + |t|*|s_n -s|$ testtest

The problem is that MathJax is somehow divided into two lines and the text looks as a part of the formula. It might be the same problem as described here, although that post discussed specifically titles in the profile page.

Here is how this post looks on my computer.

I specifically speak about he behavior at the linebreak:

• This is how it looks on my computer running Win 8.1 and Chrome 40.0.2214.111. Not the same behavior in that "test" is positioned on a new line. Feb 20 '15 at 12:43
• It appears to depend on the length of the trailing word when an inline expression is rendered on multiple lines. For me, following the expression with "te" behaves as in your question, but "tes" induces a line break. Feb 20 '15 at 12:47
• This is how the current post is rendered for me and this is what the preview shows when I click the edit button on Firefox 37.0.1, Ubuntu 14.10. Apr 25 '15 at 11:01

I only see a problem when text (a period included) is placed immediately following the closing $. If there is a space following the closing $, then the text starts on the following line and not squeezed immediately to the right of the rendered $\LaTeX$, which is broken across two lines.
It looks to me as if MathJax and the SE page layout are having problems trying to fit rendered $\LaTeX$ and markdown text in the case that they are too long and placed immediately next to each other, indicating that they should be laid out on the same line.
A problem in the cited question is the use of \over. As mentioned in answer to this question, \over is a $\TeX$ primitive and requires careful delimiting of its arguments to prevent throwing unexpected errors. It is much safer to use \frac provided by $\LaTeX$.
• But the same problem appears in my post above and I did not use either \over of \frac in the post. Feb 20 '15 at 13:36
• @MartinSleziak: the problem you are mentioning above is not the same. In the cited post, before I edited it, the $\LaTeX$ in one of the lines was not rendering at all. That is what I thought was the problem. Then I noted that \over was not used above.