2

Here's a minimal working example:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\begin{pmatrix}\\*\end{pmatrix}$
\end{document}

This produces () with no asterisk. I find that if I do the following:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\begin{pmatrix}\\**\end{pmatrix}$
\end{document}

then I get what I want. Why is this so, and what is the correct way to get an asterisk as the first entry in the second line of a pmatrix?

  • 3
    $\begin{pmatrix}\\\relax*\end{pmatrix}$. \\ is a command which has a starred form, so \\* is a variation of \\, thus the first * is consumed. The \relax prevents \\ from seeing the *. – Phelype Oleinik Feb 3 at 22:14
  • @PhelypeOleinik, what is the meaning of the stared double slash? – Sigur Feb 3 at 22:15
  • 2
    @Sigur Since \\ is a command, it can be redefined (and it is, a lot). In this case, in a pmatrix (or other matrices, or in tabular) the * does nothing different. The starred for is just kept for compatibility with other usages of \\. In plain text the * avoids a page break between the lines broken by \\. – Phelype Oleinik Feb 3 at 22:32
5

In general, the \\ command accepts a *-variant and an optional argument to add vertical spacing after the new line.

\\
\\*
\\[1ex]
\\*[1ex]

are all valid calls. The purpose of \\* is to avoid a page break. While it doesn't make sense to avoid a page break in the middle of a matrix (LaTeX would never do it), the syntax is kept in all situations.

However, in amsmath environments, placing the * on a different line than \\ will not interpret the asterisk in the way explained above.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\begin{pmatrix} *\\*\end{pmatrix}$
$\begin{pmatrix}
* \\
*
\end{pmatrix}$

\end{document}

enter image description here

If you want to input the matrix in one line, you have to somehow separate \\ and *. A \relax will do, so

$\begin{pmatrix} *\\ \relax *\end{pmatrix}$

will print the matrix exactly as the second one in the image above. Blanks won't do, instead.

The same problem would present if you want to start a matrix row after the first with [.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.