\documentclass{article}
\begin{equation}\label{eq25}
\begin{aligned}
&\left( \begin{array}{rrrr}
3 & -3 & 0 & 1 \\
\frac{16}{9} & -\frac{20}{9} & 1 & 0 \\
-2 & \frac{1}{2} & 0 & 0 \\
2 & -1 & 0 & 0
\end{array} \right)\left( \begin{array}{c}
y_{n+1} \\
y_{n+2} \\
y_{n+\frac{8}{3}} \\
y_{n+3}
\end{array} \right)
=\left( \begin{array}{rrrr}
0 & 0 & 0 & 1 \\
0 & 0 & 0 & \frac{5}{9} \\
0 & 0 & 0 & -\frac{3}{2} \\
0 & 0 & 0 & 1
\end{array} \right)\left( \begin{array}{c}
y_{n-3} \\
y_{n-2} \\
y_{n-1} \\
y_n
\end{array} \right) \\ \nonumber
&+
h^3\left( \begin{array}{rrrr}
\frac{47}{100} & \frac{23}{40} & -\frac{81}{800} & \frac{1}{20} \\
\frac{7}{27} & \frac{203}{729} & -\frac{25}{324} & \frac{65}{2187} \\
\frac{1399}{4200} & -\frac{23}{168} & \frac{783}{5600} & -\frac{17}{2800} \\ -\frac{109}{120} & \frac{61}{120} & -\frac{81}{160} & \frac{79}{360}
\end{array} \right)\left( \begin{array}{c}
f_{n+1} \\
f_{n+2} \\
f_{n+\frac{8}{3}} \\
f_{n+3}
\end{array} \right)+h^3\left( \begin{array}{rrrr}
0 & 0 & 0 & \frac{1}{160} \\
0 & 0 & 0 & \frac{31}{8748} \\
0 & 0 & 0 & -\frac{13}{224} \\
0 & 0 & 0 & -\frac{451}{1440}
\end{array} \right)\left( \begin{array}{c}
f_{n-3} \\
f_{n-2} \\
f_{n-1} \\
f_n
\end{array} \right). \nonumber %\eqno{(25)}
\end{aligned}
\end{equation}
\end{document}
问题。如何在矩阵内部的行之间添加额外的空间?
答案1
我建议使用这种变体,它始终基于pmatrix
和pmatrix*
环境,但也基于cellspace
,它使您能够定义列中单元格顶部和底部的最小垂直间距,其中说明符以字母为前缀S
(或者C
如果您加载siunitx
)。该[math]
选项将其扩展到各种matrix
环境,但不扩展到环境matrix*
。但是,一个小补丁(由软件包作者提供)使它在后一种情况下也能工作。
另一项改进是使用 \mfrac
中的(中等大小的分数)nccmath
,以避免数组和矩阵中分数和整数之间的大小差异。
\documentclass{article}
\usepackage{mathtools, nccmath}
\usepackage[math]{cellspace}
\setlength{\cellspacetoplimit}{3pt}
\setlength{\cellspacebottomlimit}{3pt}
\makeatletter
\edef\@tempa{%
\catcode`:=\the\catcode`:\relax
\catcode`_=\the\catcode`_\relax}
\catcode`:=11
\catcode`_=11
\def\MT_matrix_begin:N #1{%
\hskip -\arraycolsep
\MH_let:NwN \@ifnextchar \MH_nospace_ifnextchar:Nnn
\array{*\c@MaxMatrixCols {>{$}S#1<{$}}}}
\@tempa
\makeatother
\begin{document}
\begin{equation}\label{eq25}
\begin{aligned}
& \begin{pmatrix*}[r]
3 & -3 & 0 & 1 \\
\frac{16}{9} & -\frac{20}{9} & 1 & 0 \\
-2 & \frac{1}{2} & 0 & 0 \\
2 & -1 & 0 & 0
\end{pmatrix*} \begin{pmatrix*}
y_{n+1} \\
y_{n+2} \\
y_{n+\frac{8}{3}} \\
y_{n+3}
\end{pmatrix*}
= \begin{pmatrix*}[r]
0 & 0 & 0 & 1 \\
0 & 0 & 0 & \frac{5}{9} \\
0 & 0 & 0 & -\frac{3}{2} \\
0 & 0 & 0 & 1
\end{pmatrix*} \begin{pmatrix*}
y_{n-3} \\
y_{n-2} \\
y_{n-1} \\
y_n
\end{pmatrix*} \\ \nonumber
&+
h^3 \begin{pmatrix*}[r]
\frac{47}{100} & \frac{23}{40} & -\frac{81}{800} & \frac{1}{20} \\
\frac{7}{27} & \frac{203}{729} & -\frac{25}{324} & \frac{65}{2187} \\
\frac{1399}{4200} & -\frac{23}{168} & \frac{783}{5600} & -\frac{17}{2800} \\ -\frac{109}{120} & \frac{61}{120} & -\frac{81}{160} & \frac{79}{360}
\end{pmatrix*} \begin{pmatrix}
f_{n+1} \\
f_{n+2} \\
f_{n+\frac{8}{3}} \\
f_{n+3}
\end{pmatrix} + h^3 \begin{pmatrix*}[r]
0 & 0 & 0 & \frac{1}{160} \\
0 & 0 & 0 & \frac{31}{8748} \\
0 & 0 & 0 & -\frac{13}{224} \\
0 & 0 & 0 & -\frac{451}{1440}
\end{pmatrix*} \begin{pmatrix}
f_{n-3} \\
f_{n-2} \\
f_{n-1} \\
f_n
\end{pmatrix} \nonumber %\eqno{(25)}
\end{aligned}
\end{equation}
\bigskip
\begin{equation}\label{eq26}
\begin{aligned}
& \begin{pmatrix*}[r]
3 & -3 & 0 & 1 \\
\mfrac{16}{9} & -\mfrac{20}{9} & 1 & 0 \\
-2 & \mfrac{1}{2} & 0 & 0 \\
2 & -1 & 0 & 0
\end{pmatrix*} \begin{pmatrix*}
y_{n+1} \\
y_{n+2} \\
y_{n+\frac{8}{3}} \\
y_{n+3}
\end{pmatrix*}
= \begin{pmatrix*}[r]
0 & 0 & 0 & 1 \\
0 & 0 & 0 & \mfrac{5}{9} \\
0 & 0 & 0 & -\mfrac{3}{2} \\
0 & 0 & 0 & 1
\end{pmatrix*} \begin{pmatrix*}
y_{n-3} \\
y_{n-2} \\
y_{n-1} \\
y_n
\end{pmatrix*} \\ \nonumber
&+
h^3 \begin{pmatrix*}[r]
\mfrac{47}{100} & \mfrac{23}{40} & -\mfrac{81}{800} & \mfrac{1}{20} \\
\mfrac{7}{27} & \mfrac{203}{729} & -\mfrac{25}{324} & \mfrac{65}{2187} \\
\mfrac{1399}{4200} & -\mfrac{23}{168} & \mfrac{783}{5600} & -\mfrac{17}{2800} \\ -\mfrac{109}{120} & \mfrac{61}{120} & -\mfrac{81}{160} & \mfrac{79}{360}
\end{pmatrix*} \begin{pmatrix}
f_{n+1} \\
f_{n+2} \\
f_{n+\frac{8}{3}} \\
f_{n+3}
\end{pmatrix} + h^3 \begin{pmatrix*}[r]
0 & 0 & 0 & \mfrac{1}{160} \\
0 & 0 & 0 & \mfrac{31}{8748} \\
0 & 0 & 0 & -\mfrac{13}{224} \\
0 & 0 & 0 & -\mfrac{451}{1440}
\end{pmatrix*} \begin{pmatrix}
f_{n-3} \\
f_{n-2} \\
f_{n-1} \\
f_n
\end{pmatrix} \nonumber %\eqno{(25)}
\end{aligned}
\end{equation}
\end{document}
答案2
考虑到mathtools
包,你的方程可以写成如下形式:
\documentclass{article}
\usepackage{geometry} % <---
\usepackage{mathtools} % <---
\begin{document}
\begingroup % <---
\renewcommand\arraystretch{1.3} % <---
\begin{multline*} % <---
\begin{pmatrix*}{r} % <---
3 & -3 & 0 & 1 \\
\frac{16}{9} & -\frac{20}{9} & 1 & 0 \\
-2 & \frac{1}{2} & 0 & 0 \\
2 & -1 & 0 & 0
\end{pmatrix*}\begin{pmatrix}
y_{n+1} \\
y_{n+2} \\
y_{n+\frac{8}{3}} \\
y_{n+3}
\end{pmatrix} = \begin{pmatrix*}{r}
0 & 0 & 0 & 1 \\
0 & 0 & 0 & \frac{5}{9} \\
0 & 0 & 0 & -\frac{3}{2} \\
0 & 0 & 0 & 1
\end{pmatrix*}\begin{pmatrix}
y_{n-3} \\
y_{n-2} \\
y_{n-1} \\
y_n
\end{pmatrix} \\
%
+ h^3 \begin{pmatrix*}{r}
\frac{47}{100} & \frac{23}{40} & -\frac{81}{800} & \frac{1}{20} \\
\frac{7}{27} & \frac{203}{729} & -\frac{25}{324} & \frac{65}{2187} \\
\frac{1399}{4200} & -\frac{23}{168} & \frac{783}{5600} & -\frac{17}{2800} \\ -\frac{109}{120} & \frac{61}{120} & -\frac{81}{160} & \frac{79}{360}
\end{pmatrix*}\begin{pmatrix}
f_{n+1} \\
f_{n+2} \\
f_{n+\frac{8}{3}} \\
f_{n+3}
\end{pmatrix} + h^3 \begin{pmatrix*}{r}
0 & 0 & 0 & \frac{1}{160} \\
0 & 0 & 0 & \frac{31}{8748} \\
0 & 0 & 0 & -\frac{13}{224} \\
0 & 0 & 0 & -\frac{451}{1440}
\end{pmatrix*}\begin{pmatrix}
f_{n-3} \\
f_{n-2} \\
f_{n-1} \\
f_n
\end{pmatrix}.
\end{multline*}
\endgroup
\end{document}
(红线表示文本边框)
\renewcommand\arraystretch{1.3}
通过将 放在方程前面(通过对该方程形成群将其限制在方程内),可以获得矩阵行之间的更多空间 。{pmatrix*}{r}
而是使用数组mathtools
。它允许矩阵的短写,并且其中的数字是右对齐的- 代替
aligned
使用multline
˛
答案3
我刚刚添加了[0.25em]
以下内容\\
:
\frac{16}{9} & -\frac{20}{9} & 1 & 0 \\ [0.25em]