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.

  • 4
    See Why is \[\] preferable to $$? – Werner Oct 7 '14 at 17:03
  • 1
    Hello! What is blockarray? And where is pmatrix started? And heck, could you please provide a minimal working example (MWE)? – yo' Oct 7 '14 at 17:04
  • You need to inform us of what \BAmulticolumn looks like. In fact, instead of providing us with only a code snippet, show a minimal working example (MWE). – Werner Oct 7 '14 at 17:04
  • The \end{pmatrix} was a typo, removing it hasn't changed the issue, though. I actually couldn't provide a MWE because I really have no idea what I'm doing - I copy pasted this snippet and modified it using my limited knowledge of TeX until it (mostly) worked. – Jack M Oct 7 '14 at 17:07
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}
  • Could you explain why $s are needed in the \multirow? Does the \begin{blockmatrix} break out of math mode? – Jack M Oct 7 '14 at 17:14
  • @JackM: Added brief explanation. – Peter Grill Oct 7 '14 at 17:21
  • A simple pmatrix will produce the same result.The blkarray environment is designed for block matrices. – Bernard Oct 7 '14 at 17:45
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

  • 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 7 '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 7 '14 at 20:43

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.