3

I cannot see what is wrong with the following and would appreciate any pointers.

\documentclass[margin=1mm]{standalone}

\usepackage{amsmath}
\usepackage{blkarray, bigstrut}
\usepackage{setspace}

\begin{document}
    \setstretch{1.3}
    %\[
    \begin{align*}
    \begin{blockarray}{ccccc}
    & A_{1} & A_{2} & A_{3} & A_{4} \\
    \begin{block}{c[cccc]}
    q_{1} & 0 & 1 & 1 & 0  \bigstrut[t] \\
    q_{2} & 1 & 1 & 1 & 0 \\
    q_{3} & 1 & 0 & 0 & 1 \\
    q_{4} & 0 & 0 & 1 & 0 \bigstrut[b]\\
    \end{block}
    \end{blockarray}\vspace*{-0.6\baselineskip}
    \end{align*}
    %\]

\end{document}

This gives me errors with the environment:

Missing \endgroup inserted. \end{align*}
Missing } inserted. \end{align*}
\begin{document} ended by \end{align*}. \end{align*}
Missing $ inserted. \end{align*}
Display math should end with $$. \end{align*}
Extra \endgroup. \end{align*}
Too many }'s. \end{document}
Overfull \hbox (116.89484pt too wide) detected

I also tried with \[ \] environment rather than align* but that use gives me a different set of errors:

Missing $ inserted. & A_
Extra }, or forgotten $. & A_{1} &
Missing $ inserted. & A_{1} &
Missing } inserted. & A_{1} &
Missing $ inserted. & A_{1} & A_
Extra }, or forgotten $. & A_{1} & A_{2} &
Missing $ inserted. & A_{1} & A_{2} &
Missing } inserted. & A_{1} & A_{2} &
Missing $ inserted. & A_{1} & A_{2} & A_
Extra }, or forgotten $. & A_{1} & A_{2} & A_{3} &
Missing $ inserted. & A_{1} & A_{2} & A_{3} &
Missing } inserted. & A_{1} & A_{2} & A_{3} &
Missing $ inserted. & A_{1} & A_{2} & A_{3} & A_
Extra }, or forgotten $. \begin
Missing $ inserted. \begin
Missing } inserted. \begin
Missing $ inserted. q_
Extra }, or forgotten $. q_{1} &
Missing $ inserted. q_{1} &
Missing } inserted. q_{1} &
Missing $ inserted. q_
Extra }, or forgotten $. q_{2} &
Missing $ inserted. q_{2} &
Missing } inserted. q_{2} &
Missing $ inserted. q_
Extra }, or forgotten $. q_{3} &
Missing $ inserted. q_{3} &
Missing } inserted. q_{3} &
Missing $ inserted. q_
Extra }, or forgotten $. q_{4} &
Missing $ inserted. q_{4} &
Missing } inserted. q_{4} &
Bad math environment delimiter. \]
  • why use align at all here you only have a single line and no alignment point? – David Carlisle May 25 at 20:03
  • Good point. Do you know why I am getting errors with the [ ... ]? – ozsu May 25 at 20:04
6

The errors are an artefact of standalone processing, this works

\documentclass[margin=1mm]{article}

\usepackage{amsmath}
\usepackage{blkarray, bigstrut}
\usepackage{setspace}

\begin{document}
    \setstretch{1.3}
\[
    \begin{blockarray}{ccccc}
    & A_{1} & A_{2} & A_{3} & A_{4} \\
    \begin{block}{c[cccc]}
    q_{1} & 0 & 1 & 1 & 0  \bigstrut[t] \\
    q_{2} & 1 & 1 & 1 & 0 \\
    q_{3} & 1 & 0 & 0 & 1 \\
    q_{4} & 0 & 0 & 1 & 0 \bigstrut[b]\\
    \end{block}
    \end{blockarray}\vspace*{-0.6\baselineskip}
\]

\end{document}

or with standalone

\documentclass[margin=1mm]{standalone}

\usepackage{amsmath}
\usepackage{blkarray, bigstrut}
\usepackage{setspace}

\begin{document}
    \setstretch{1.3}
$
    \begin{blockarray}{ccccc}
    & A_{1} & A_{2} & A_{3} & A_{4} \\
    \begin{block}{c[cccc]}
    q_{1} & 0 & 1 & 1 & 0  \bigstrut[t] \\
    q_{2} & 1 & 1 & 1 & 0 \\
    q_{3} & 1 & 0 & 0 & 1 \\
    q_{4} & 0 & 0 & 1 & 0 \bigstrut[b]\\
    \end{block}
    \end{blockarray}\vspace*{-0.6\baselineskip}
$

\end{document}
  • Thanks much; did not know that difference. Something new learned. – ozsu May 25 at 20:14
  • @ozsu as a general rule display constructs do not work in standalone unless you use the varwidth option but for a table of fixed width just using inline math is simpler. – David Carlisle May 25 at 20:22

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.