2

I'm getting "missing $ inserted" (along with a lot of other nearby errors, but that's the first one) on this snippet:

$$
(\tilde A-\lambda)^m =
\begin{blockarray}{(cccc)}
        \BAmulticolumn{3}{c}{\multirow{3}{*}{(A-\lambda)^m}} & \multirow{3}{*}{\vdots} \\
        & & & & \\ \\
        0 & \dots & 0 & (1-\lambda)^m
\end{blockarray}
\end{pmatrix}
$$

Specifically, it's at the line

\BAmulticolumn{3}{c}{\multirow{3}{*}{(A-\lambda)^m}} & \multirow{3}{*}{\vdots}

I can't find a way to see exactly where the $ was inserted, but either way I have no idea why there would be one there. The code renders fine, the error is just bothering me.

Jack M
  • 146

2 Answers2

4

You need neither multirow nor blkarray:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\[
(\tilde A-\lambda)^m =
\begin{pmatrix}
(A-\lambda)^m & \vdots\vphantom{\Bigg|} \\
\begin{matrix}0 & \dots & 0\end{matrix} & (1-\lambda)^m
\end{pmatrix}
\]

\end{document}

enter image description here

egreg
  • 1,121,712
  • why not just 0 \quad\dots\quad 0 for the first part of the second line, and why is the extra height needed with the \Bigg|? adding an optional space [2\jot] (or even a bit more) would put the extra space only between the lines where it's really wanted. (or am i missing something?) – barbara beeton Oct 07 '14 at 20:38
  • @barbarabeeton I wanted to reproduce the same spacing made by pmatrix, so a nested matrix seems best. The space above (A-\lambda)^m is probably meant for making clear that it's a submatrix, rather than a row. – egreg Oct 07 '14 at 20:43
3

You were missing the $ in the \multirow and had an extraneous \end{pmatrix}:

enter image description here

Notes:

  • I replaced the $$...$$ with \[ ... \]. As Werner pointed out, please see Why is \[ ... \] preferable to $$ ... $$?.
  • The $ were required in the option to \multirow as that parameter is assumed to be in text mode. Using the $ ensures that math mode is used.

Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{blkarray}
\usepackage{multirow}

\begin{document}

[ (\tilde A-\lambda)^m = \begin{blockarray}{(cccc)} \BAmulticolumn{3}{c}{\multirow{3}{}{$(A-\lambda)^m$}} & \multirow{3}{}{\vdots} \ & & & & \ \ 0 & \dots & 0 & (1-\lambda)^m \end{blockarray} %\end{pmatrix} ] \end{document}

Peter Grill
  • 223,288