我在文档中放置了一个大矩阵,但矩阵超出了边界。我想知道如何调整它的大小?以下是矩阵的代码:
\[\mathcal{W}_{i,:,:}=
\begin{bmatrix}
\mat{W_1}[i,1] & \mat{W_1}[i,2] & ...& \mat{W_1}[i,d_1] \\
\mat{W_1}[i,2] & \mat{W_1}[i,d_1+1] & ...& \mat{W_1}[i,2d_1-1]\\
...&...&...&...\\
\mat{W_1}[i,d_1] & \mat{W_1}[i,d_1+1] & ... &\mat{W_1}[i,\cfrac{1+d_1}{2}*d_1]
\end{bmatrix},
\]
答案1
您可能需要缩小\arraycolsep
并改变其显示方式:
\documentclass[twocolumn]{article}
\usepackage{lipsum}
\usepackage{amsmath}
\newcommand{\mat}{\mathbf}
\begin{document}
\lipsum*[1]
\begin{align*}
&\mathcal{W}_{i,:,:}= \\
&\setlength{\arraycolsep}{.4\arraycolsep}
\begin{bmatrix}
\mat{W_1}[i, 1] & \mat{W_1}[i, 2] & \cdots & \mat{W_1}[i, d_1] \\
\mat{W_1}[i, 2] & \mat{W_1}[i, d_1 + 1] & \cdots & \mat{W_1}[i, 2d_1 - 1] \\
\cdots & \cdots & \cdots & \cdots \\
\mat{W_1}[i, d_1] & \mat{W_1}[i, d_1 + 1] & \cdots & \mat{W_1}[i, \tfrac{1 + d_1}{2} \times d_1]
\end{bmatrix},
\end{align*}
\lipsum*[2]
\end{document}
答案2
旁\arraycolsep
您还可以缩小数学运算符周围的空格和之间的距离西及其索引:
\documentclass[twocolumn]{article}
\usepackage{amsmath}
\newcommand{\bfW}{\mathbf{W}_{\!1}}
\usepackage{lipsum}
\begin{document}
\lipsum*[1]
\[\setlength{\arraycolsep}{1.5pt}
\mathcal{W}_{i,:,:}=
\begin{bmatrix}
\bfW[i, 1] & \bfW[i, 2] & \dotsm & \bfW[i, d_1] \\
\bfW[i, 2] & \bfW[i, d_1{+}1] & \dotsm & \bfW[i, 2d_1{-}1] \\
\dotsm & \dotsm & \dotsm & \dotsm \\
\bfW[i, d_1] & \bfW[i, d_1{+}1] & \dotsm & \bfW[i, \frac{1{+}d_1}{2} {\times} d_1]
\end{bmatrix}\!,
\]
\lipsum*[2]
\end{document}