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.
\diag
is not supported in LaTeX either: Inline Notation for the Diagonal of a Matrix?. (Unless you load some package defining this command.) On Mathematics you can use$\newcommand{\diag}{\operatorname{diag}}$
and after that you can use\diag
. For example, it was defined this way in this question: Connecting an almost idempotent complex matrix to a diagonal 1-0 matrix $\endgroup$$$
is disallowed in the titles: Using block (displayed) equations in question titles. But from your post it seems that one can bypass this by\[
and\]
. This was also pointed out here: Circumventing displayed equation ban in titles. $\endgroup$\[...\]
behaves differently in the body and in the title. 10k+ users can see this also here (link to a deleted question on the main where I tested the same thing). $\endgroup$