In $\LaTeX$, it is not recommended using

$$...  $$

for display mode formulas, and


is more recommended. But it seems the latter is not supported on MSE. MSE supports


, but this is akward for typing. Why \[...\] is not supported?

And I also found \diag, which gives diag in roman font in maths formulas is neither supported.


1 Answer 1


This answer is meant for testing purposes. (Feel free to edit it if you want to try something related to the issue at hand.)

\[ x^2+y^2=z^2 \] - this works neither in the preview nor in the final post.

[ x^2+y^2=z^2 ]

\\[ x^2+y^2=z^2 \\] - this works both in the preview and in the posted answer.

\[ x^2+y^2=z^2 \]

As mentioned in the question $$ x^2+y^2=z^2 $$ works, too.

$$ x^2+y^2=z^2 $$

If I include $\newcommand{\diag}{\operatorname{diag}}$, then I can use things like $\diag(\lambda_1,\lambda_2,\dots,\lambda_n)$.$\newcommand{\diag}{\operatorname{diag}}$ Here is an example: $\diag(\lambda_1,\lambda_2,\dots,\lambda_n)$.

The scope of \newcommand is now restricted to the post (or the comment) where the definition is used - this behavior used to be different, but this was changed in 2019.

  • 2
    $\begingroup$ ...I can't believe I'm only now learning that \\[...\\] works. Inspecting the website for MathJax settings shows that \\\\(...\\\\) should also work for inline maths: \\\(a + b = c\\\). I get it to work in the preview, have not tried in an answer $\endgroup$ Jan 16 at 13:32
  • 3
    $\begingroup$ See also this post. Note that the MathJax configuration used on StackExchange sites over-escapes the inline delimiters, meaning you need to use quadruple backslashes for them. $\endgroup$ Jan 17 at 11:19
  • 2
    $\begingroup$ Better yet, see my answer here. I knew I had answered it before. $\endgroup$ Jan 17 at 11:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .