markup icon indicating copy to clipboard operation
markup copied to clipboard

LaTeX `\\` requires escaping

Open jonatanklosko opened this issue 3 years ago • 2 comments

\\ is often used to indicate matrix rows. It currently works at the end of a line:

$$
\begin{bmatrix}
  1 & 2 \\
  3 & 4
\end{bmatrix}
$$

$$ \begin{bmatrix} 1 & 2 \ 3 & 4 \end{bmatrix} $$

however it doesn't work in the middle

$$
\begin{bmatrix}
  1 & 2 \\ 3 & 4
\end{bmatrix}
$$

$$ \begin{bmatrix} 1 & 2 \ 3 & 4 \end{bmatrix} $$

Escaping backslashes as in \\\\ helps, but I believe this is not expected.

jonatanklosko avatar May 20 '22 14:05 jonatanklosko

I think it doesn't work in the middle in order to guarantee readability

mariavaleriabonini avatar Jun 13 '22 14:06 mariavaleriabonini

Also the \, command escaping backslash. This command is used to introduce some extra space. The workaround is to write it as \\,.

\int f(x)\,x\mathrm{d}

is rendered as

$$ \int f(x),\mathrm{d}x $$

But should be rendered as

$$ \int f(x)\, \mathrm{d}x $$

milasudril avatar Jul 09 '22 09:07 milasudril