\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
。它允許矩陣的 dhorter 寫入以及其中的數字右對齊- 而不是
aligned
使用multline
˛
答案3
我剛剛添加了[0.25em]
之後\\
:
\frac{16}{9} & -\frac{20}{9} & 1 & 0 \\ [0.25em]