# Unusual behavior of \\ in pmatrix environment

I found an unusual behavior of pmatrix environment when editing a post.

Basically, when editing this question $A=\begin{pmatrix} 0&9 \cr -1&0 \end{pmatrix}$ renders correctly, but $A=\begin{pmatrix} 0&9 \\ -1&0 \end{pmatrix}$ does not. The only difference is that in one case I use \cr to make new line, in the other case I use \\.

As you can see, both versions render correctly here:
$A=\begin{pmatrix} 0&9 \cr -1&0 \end{pmatrix}$ and $A=\begin{pmatrix} 0&9 \\ -1&0 \end{pmatrix}$.

However, here is screenshot showing what the matrix/question looked like when I used version with \\ instead of \cr: I don't think it's a big deal, but it I'm curious why the same code behaves differently in that question. And also it might be useful to know, in case something similar might manifest elsewhere.

EDIT: Now I am confused even more. At the moment the question renders ok with \ (at least I see it rendered correctly). But when I click on edit, the preview show the strange version with the exclamation mark.

The answer to that question contains the definition $\def\\#1{\frac1{#1!}}$ which spills over to the preview, but not to the question. (Owing to the order of script execution, I assume).
• D'oh!. I searched whether there is \newcommand somewhere in the source. And \def simply did not occur to me. Based on this older post I would expect the same behavior in the question: The scope of \newcommand is the entire page Nov 28, 2014 at 7:04
• Quite a horrible incident. Almost as bad as someone redefining other core commands. Like integrals and sine stuff. Try it out... $\newcommand{\sin}{\text{Troll'd!}}\newcommand{\int}{\text{Ha ha }}\newcommand{\cos}{\text{ Fo' shizzle!}}$
• @AsafKaragila As we all know, $\int \sin(x)\;dx = -\cos(x)$. :) Dec 1, 2014 at 23:45
{"ft_lang_label":"__label__en","ft_lang_prob":0.8315576,"math_prob":0.8160633,"size":1004,"snap":"2023-40-2023-50","text_gpt3_token_len":276,"char_repetition_ratio":0.137,"word_repetition_ratio":0.012269938,"special_character_ratio":0.26792827,"punctuation_ratio":0.098522164,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9766352,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,8,null,8,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-25T00:22:52Z\",\"WARC-Record-ID\":\"<urn:uuid:52e53a0c-5ce4-455e-ab9a-1071bcfbb283>\",\"Content-Length\":\"105736\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:2132570e-fdaf-4cf5-82fa-bc4a545c7a2d>\",\"WARC-Concurrent-To\":\"<urn:uuid:c303f129-7c11-44e7-83fe-12828c923bec>\",\"WARC-IP-Address\":\"104.18.10.86\",\"WARC-Target-URI\":\"https://math.meta.stackexchange.com/questions/17477/unusual-behavior-of-in-pmatrix-environment\",\"WARC-Payload-Digest\":\"sha1:TFUA2GAZEGVORQCW4TVQX6AJ57M7LWYP\",\"WARC-Block-Digest\":\"sha1:JBA46A5OZBR3H2BUSATEBBUKU6L5J3DY\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233506669.96_warc_CC-MAIN-20230924223409-20230925013409-00121.warc.gz\"}"}