align* 环境问题

align* 环境问题

我看不出以下内容有什么问题,并希望得到任何指点。

\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}

这导致环境出现错误:

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

我也尝试使用\[ \]环境而不是align*但使用环境给了我一组不同的错误:

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. \]

答案1

这些错误是standalone加工过程中产生的,这是有效的

\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}

或独立

\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}

相关内容