Oh dear, I didn’t notice that there were
\\
inside $$...$$
without any proper environment. This is basically invalid syntax, and it is not supposed to work. (In actual LaTeX, it doesn’t produce a line break.) You seem not to have submitted the edit, so I will. — Emil Jeřábek 2 hours ago