我问了一个问题这里关于如何在偶数页和奇数页上以不同方式对齐表格。现在我需要align
对环境中编写的方程式执行相同的操作。我尝试了针对表格提出的相同技巧。它们似乎不起作用。有人能帮我吗?谢谢。我的示例如下。
\documentclass[a4paper, twoside, hidelinks, 11pt]{book}
\usepackage{lipsum}
\usepackage{amsmath}
\begin{document}
\lipsum
\begin{align*}
\frac{\sigma^2}{n}
\begin{bmatrix}
\alpha_1(1-\alpha_1)^{2\xi_0-1} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_2(1-\alpha_2)^{2\xi_0-1} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_3(1-\alpha_3)^{2\xi_0-1}
\end{bmatrix}.
\end{align*}
\end{document}
答案1
我提出两种解决方案:
- 要么使用
\mathclap
(从mathtools
),这样等式两边的溢出均等。另一种方法是设置一个较小的 值arraycolsep
。 - 或者您使用
medsize
环境(来自nccmath
)。
让我补充一点,如果您加载geometry
(不带任何选项),您将有更合理的利润,并且不会出现任何问题。
\documentclass[a4paper, twoside, hidelinks, 11pt]{book}
\usepackage{lipsum}
\usepackage{mathtools, nccmath}
\begin{document}
\lipsum
\[ \mathclap{\frac{\sigma^2}{n}
\begin{bmatrix}
\alpha_1(1-\alpha_1)^{2\xi_0-1} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_2(1-\alpha_2)^{2\xi_0-1} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_3(1-\alpha_3)^{2\xi_0-1}
\end{bmatrix}.} \]
\vskip0.5cm
\[ \setlength\arraycolsep{3pt}
\mathclap{\frac{\sigma^2}{n}
\begin{bmatrix}
\alpha_1(1-\alpha_1)^{2\xi_0-1} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_2(1-\alpha_2)^{2\xi_0-1} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_3(1-\alpha_3)^{2\xi_0-1}
\end{bmatrix}.} \]
\vskip0.5cm
\[ \frac{\sigma^2}{n}
\begin{medsize}\begin{bmatrix}
\alpha_1(1-\alpha_1)^{2\xi_0-1} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_2(1-\alpha_2)^{2\xi_0-1} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_3(1-\alpha_3)^{2\xi_0-1}
\end{bmatrix}\end{medsize}. \]
\end{document}
enter image description here
答案2
我建议你找到减小其大小的方法,而不是让方程溢出到一个或两个边距。使矩阵适合文本块的一种方法包括 (i) 将\medmuskip
控制二元运算符(例如-
)周围空间的参数 设置为零,(ii) 减少列间空白量,以及 (iii) 切换到略小的字体大小。
我认为,更好的方法是根本不展示完整的 3x3 对称矩阵。相反,展示矩阵可以写成两个向量的外积。据推测,矩阵的对称结构才是真正重要的;我怀疑展示 3x3 矩阵所有九个元素的内容就没那么重要了。
\documentclass[a4paper, twoside, hidelinks, 11pt]{book}
\usepackage{lipsum}
\usepackage{amsmath}
\begin{document}
\hrule
\medskip
Unmodified:
\[
\frac{\sigma^2}{n}
\begin{bmatrix}
\alpha_1(1-\alpha_1)^{2\xi_0-1} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_2(1-\alpha_2)^{2\xi_0-1} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_3(1-\alpha_3)^{2\xi_0-1}
\end{bmatrix}.
\]
\bigskip
Better: Adjust some of the matrix parameters.
{\small % 10% linear font size reduction
\setlength\arraycolsep{2.5pt} % default value: 5pt
\setlength\medmuskip{0mu} % default value: 5mu
\[
\frac{\sigma^2}{n}
\begin{bmatrix}
\alpha_1(1-\alpha_1)^{2\xi_0-1} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} \,& \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_2(1-\alpha_2)^{2\xi_0-1} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_3(1-\alpha_3)^{2\xi_0-1}
\end{bmatrix}.
\]
}
\bigskip
Best: Don't show the full $3\times3$ matrix at all.
{\renewcommand\arraystretch{1.3} % increase line spacing
\[
\frac{\sigma^2}{n}
\begin{bmatrix}
\alpha_1(1-\alpha_1)^{\xi_0-1} \\
\alpha_2(1-\alpha_2)^{\xi_0-1} \\
\alpha_3(1-\alpha_3)^{\xi_0-1}
\end{bmatrix}
\begin{bmatrix}
(1-\alpha_1)^{\xi_0} & (1-\alpha_2)^{\xi_0} & (1-\alpha_3)^{\xi_0}
\end{bmatrix}
\]
\bigskip
\hrule
\end{document}