为什么Resizebox和blockarray会报错?

为什么Resizebox和blockarray会报错?

我正在制作一张桌子blkarray,但我需要缩放它以使其适合:

\documentclass{memoir}
\usepackage{blkarray}
\usepackage{graphicx}

\begin{document}
\begin{table}[tbp]
\caption{Lore ipsum}
\resizebox{\textwidth}{!}{
\[ 
\begin{blockarray}{rccccccccccccc}
& O1 & C2 & O3 & C4 & C5 & C6 & C7 & C8 & C9 & C10 & O11 & O12 & C13 \\
\begin{block}{r[ccccccccccccc]}
O1 & 0 & 2 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
C2 & 2 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\
O3 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
C4 & 0 & 0 & 1 & 0 & 1.5 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
C5 & 0 & 0 & 0 & 1.5 & 0 & 1.5 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
C6 & 0 & 0 & 0 & 0 & 1.5 & 0 & 1.5 & 0 & 0 & 0 & 0 & 0 & 0 \\
C7 & 0 & 0 & 0 & 0 & 0 & 1.5 & 0 & 1.5 & 0 & 0 & 0 & 0 & 0 \\
C8 & 0 & 0 & 0 & 0 & 0 & 0 & 1.5 & 0 & 1.5 & 0 & 0 & 0 & 0 \\
C9 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1.5 & 0 & 1 & 0 & 0 & 0 \\
C10 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 2 & 1 & 0 \\
O11 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 2 & 0 & 0 & 0 \\
O12 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\
C13 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
\end{block}
\end{blockarray}
\]
}
\end{table}
\end{document}

但我一直收到奇怪的错误。该如何实现?

答案1

分隔符\[...\]不会产生可由 操作的水平模式量\resizebox。因此,将\[\]分隔符更改为$$

显示为showframe

\documentclass{memoir}
\usepackage{blkarray}
\usepackage{graphicx}
\usepackage[pass,showframe]{geometry}

\begin{document}
\begin{table}[tbp]
\caption{Lore ipsum}
\resizebox{\textwidth}{!}{
$ 
\begin{blockarray}{rccccccccccccc}
& O1 & C2 & O3 & C4 & C5 & C6 & C7 & C8 & C9 & C10 & O11 & O12 & C13 \\
\begin{block}{r[ccccccccccccc]}
O1 & 0 & 2 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
C2 & 2 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\
O3 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
C4 & 0 & 0 & 1 & 0 & 1.5 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
C5 & 0 & 0 & 0 & 1.5 & 0 & 1.5 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
C6 & 0 & 0 & 0 & 0 & 1.5 & 0 & 1.5 & 0 & 0 & 0 & 0 & 0 & 0 \\
C7 & 0 & 0 & 0 & 0 & 0 & 1.5 & 0 & 1.5 & 0 & 0 & 0 & 0 & 0 \\
C8 & 0 & 0 & 0 & 0 & 0 & 0 & 1.5 & 0 & 1.5 & 0 & 0 & 0 & 0 \\
C9 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1.5 & 0 & 1 & 0 & 0 & 0 \\
C10 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 2 & 1 & 0 \\
O11 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 2 & 0 & 0 & 0 \\
O12 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\
C13 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
\end{block}
\end{blockarray}
$
}
\end{table}
\end{document}

在此处输入图片描述

相关内容