我想根据需要缩小以下方程的大小以适合页面。是否有某种命令可以使字体大小适应页面宽度?
这是我的乳胶:
\begin{equation}
d\left(\begin{array}{c}
D(t) \\ \Pi(t) \\ \Theta(t)
\end{array}\right)
=
\left(\begin{array}{ccc}
-\alpha_{D} & 1 & 0 \\
0 & -\alpha_{\Pi} & 0 \\
0 & 0 & -\alpha_{\Theta}
\end{array}\right)
\left(\begin{array}{c}
D(t) \\ \Pi(t) \\ \Theta(t)
\end{array}\right)
+
\left(\begin{array}{ccc}
\sigma_{D,D} & \sigma_{D,\Pi} & 0 \\
0 & \sigma_{\Pi,\Pi}& 0 \\
\sigma_{\Theta,D} & 0 & \sigma_{\Theta,\Theta}
\end{array}\right)
d \left(\begin{array}{c}
w_{D}(t)\\ w_{\Pi}(t) \\ w_{\Theta}(t)
\end{array}\right)
\end{equation}
这是我得到的结果(正如您所见,等式超出了正确的页面范围):
笔记:我尝试使用
\resizebox{.9 \textwidth}{!}
{
\begin{equation}
[...] % My equation here
\end{equation}
}
但是我收到一个编译错误。
答案1
正如其他人所说,最好避免缩放。在这种情况下,您很可能可以在不缩放的情况下将其放在一行中。您正在加载amsmath
但不使用它的矩阵环境,这意味着大括号周围的空间比需要的多得多。只需进行这种更改并稍微压缩列间距即可使内容适合此处:
\documentclass[a4paper]{article}
\addtolength\textwidth{10mm}% try to get initial position like image shown No test file provided :(((
\usepackage{amsmath}
\begin{document}
original
\begin{equation}
d\left(\begin{array}{c}
D(t) \\ \Pi(t) \\ \Theta(t)
\end{array}\right)
=
\left(\begin{array}{ccc}
-\alpha_{D} & 1 & 0 \\
0 & -\alpha_{\Pi} & 0 \\
0 & 0 & -\alpha_{\Theta}
\end{array}\right)
\left(\begin{array}{c}
D(t) \\ \Pi(t) \\ \Theta(t)
\end{array}\right)
+
\left(\begin{array}{ccc}
\sigma_{D,D} & \sigma_{D,\Pi} & 0 \\
0 & \sigma_{\Pi,\Pi}& 0 \\
\sigma_{\Theta,D} & 0 & \sigma_{\Theta,\Theta}
\end{array}\right)
d \left(\begin{array}{c}
w_{D}(t)\\ w_{\Pi}(t) \\ w_{\Theta}(t)
\end{array}\right)
\end{equation}
ams matrices
\begin{equation}\setlength\arraycolsep{4pt}
d\begin{pmatrix}
D(t) \\ \Pi(t) \\ \Theta(t)
\end{pmatrix}
=
\begin{pmatrix}
-\alpha_{D} & 1 & 0 \\
0 & -\alpha_{\Pi} & 0 \\
0 & 0 & -\alpha_{\Theta}
\end{pmatrix}
\begin{pmatrix}
D(t) \\ \Pi(t) \\ \Theta(t)
\end{pmatrix}
+
\begin{pmatrix}
\sigma_{D,D} & \sigma_{D,\Pi} & 0 \\
0 & \sigma_{\Pi,\Pi}& 0 \\
\sigma_{\Theta,D} & 0 & \sigma_{\Theta,\Theta}
\end{pmatrix}
d \begin{pmatrix}
w_{D}(t)\\ w_{\Pi}(t) \\ w_{\Theta}(t)
\end{pmatrix}
\end{equation}
\end{document}
答案2
本案例选择的环境是multline
。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{multline}
d\begin{pmatrix}
D(t) \\ \Pi(t) \\ \Theta(t)
\end{pmatrix}
=
\begin{pmatrix}
-\alpha_{D} & 1 & 0 \\
0 & -\alpha_{\Pi} & 0 \\
0 & 0 & -\alpha_{\Theta}
\end{pmatrix}
\begin{pmatrix}
D(t) \\ \Pi(t) \\ \Theta(t)
\end{pmatrix} \\
+
\begin{pmatrix}
\sigma_{D,D} & \sigma_{D,\Pi} & 0 \\
0 & \sigma_{\Pi,\Pi}& 0 \\
\sigma_{\Theta,D} & 0 & \sigma_{\Theta,\Theta}
\end{pmatrix}
d \begin{pmatrix}
w_{D}(t)\\ w_{\Pi}(t) \\ w_{\Theta}(t)
\end{pmatrix}
\end{multline}
\end{document}
注意 的用法pmatrix
。
认为这并没有直接回答问题的反对意见应该被驳回,但举一个例子来自己判断并不难。
\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\newenvironment{scaledequation}
{\begin{equation}\begin{lrbox}{\scaledequationbox}$\displaystyle}
{$\end{lrbox}%
\resizebox{0.9\displaywidth}{!}{\usebox{\scaledequationbox}}%
\end{equation}
\ignorespacesafterend}
\newsavebox{\scaledequationbox}
\begin{document}
This is how a long equation should be treated when it's too wide for
fitting the given text width
\begin{multline}
d\begin{pmatrix}
D(t) \\ \Pi(t) \\ \Theta(t)
\end{pmatrix}
=
\begin{pmatrix}
-\alpha_{D} & 1 & 0 \\
0 & -\alpha_{\Pi} & 0 \\
0 & 0 & -\alpha_{\Theta}
\end{pmatrix}
\begin{pmatrix}
D(t) \\ \Pi(t) \\ \Theta(t)
\end{pmatrix} \\
+
\begin{pmatrix}
\sigma_{D,D} & \sigma_{D,\Pi} & 0 \\
0 & \sigma_{\Pi,\Pi}& 0 \\
\sigma_{\Theta,D} & 0 & \sigma_{\Theta,\Theta}
\end{pmatrix}
d \begin{pmatrix}
w_{D}(t)\\ w_{\Pi}(t) \\ w_{\Theta}(t)
\end{pmatrix}
\end{multline}
On the other hand, you could rescale the material to fit, with a
dubious result, which you can compare to the previous one
\begin{scaledequation}
d\begin{pmatrix}
D(t) \\ \Pi(t) \\ \Theta(t)
\end{pmatrix}
=
\begin{pmatrix}
-\alpha_{D} & 1 & 0 \\
0 & -\alpha_{\Pi} & 0 \\
0 & 0 & -\alpha_{\Theta}
\end{pmatrix}
\begin{pmatrix}
D(t) \\ \Pi(t) \\ \Theta(t)
\end{pmatrix}
+
\begin{pmatrix}
\sigma_{D,D} & \sigma_{D,\Pi} & 0 \\
0 & \sigma_{\Pi,\Pi}& 0 \\
\sigma_{\Theta,D} & 0 & \sigma_{\Theta,\Theta}
\end{pmatrix}
d \begin{pmatrix}
w_{D}(t)\\ w_{\Pi}(t) \\ w_{\Theta}(t)
\end{pmatrix}
\end{scaledequation}
I have no doubt whatsoever as to which one I'd choose.
\end{document}
答案3
开始调整数学字体大小永远不是一个好的解决方案,(1) 它会带来不一致的设计,并且 (2) 损害可读性。相反,学会打破数学,它将成为您未来文档中的重要工具。
\documentclass[a4paper]{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{aligned}
d\begin{pmatrix}{c} D(t) \\ \Pi(t) \\ \Theta(t)
\end{pmatrix}
= {} & % note the {} in front of & in this case
\begin{pmatrix}
-\alpha_{D} & 1 & 0 \\
0 & -\alpha_{\Pi} & 0 \\
0 & 0 & -\alpha_{\Theta}
\end{pmatrix}
\begin{pmatrix}
D(t) \\ \Pi(t) \\ \Theta(t)
\end{pmatrix}
\\
& +
\begin{pmatrix}
\sigma_{D,D} & \sigma_{D,\Pi} & 0 \\
0 & \sigma_{\Pi,\Pi}& 0 \\
\sigma_{\Theta,D} & 0 & \sigma_{\Theta,\Theta}
\end{pmatrix}
d \begin{pmatrix} w_{D}(t)\\ w_{\Pi}(t) \\ w_{\Theta}(t)
\end{pmatrix}
\end{aligned}
\end{equation}
\end{document}
这里我也使用了pmatrix
env,因为它可以减少输入。
还请注意我如何提供完整的最小示例,包括文档类和适当的序言。这让其他人测试代码变得容易得多。