
下の図に示すように、行列内の要素の周囲のパディングを調整することは可能ですか。
コードは以下のとおりです
\documentclass{scrartcl}
\usepackage{amsmath}
\begin{document}
... in general we have
\begin{equation}
\begin{bmatrix}
\frac{\partial f_1}{\partial x_1} & \cdots &
\frac{\partial f_1}{\partial x_n} \\
\vdots & \ddots & \vdots \\
\frac{\partial f_m}{\partial x_1} & \cdots &
\frac{\partial f_m}{\partial x_n}
\end{bmatrix}
\end{equation}
and for the particular case of $m=n=2$
\begin{equation}
\begin{bmatrix}
\frac{\partial f_1}{\partial x_1} & \frac{\partial f_1}{\partial x_2} \\
\frac{\partial f_2}{\partial x_1} & \frac{\partial f_2}{\partial x_2}
\end{bmatrix}
\end{equation}
Is it possible to insert some space around the elements in (2)? The matrix looks a bit cramped.
\end{document}
答え1
以下は を使用したコードです。無関係ですが、 偏導関数の入力を簡素化するために パッケージ を使用し、行列に中程度のサイズの分数を持たせるために のコマンドcellspace
を使用することをお勧めします (デフォルトは)。diffcoeff
\medmath
nccmath
\tfrac
\documentclass{article}
\usepackage{amsmath, nccmath}
\usepackage{diffcoeff}
\usepackage[math]{cellspace}
\setlength{\cellspacetoplimit}{2pt}
\setlength{\cellspacebottomlimit}{2pt}
\begin{document}
\[ J = \begin{pmatrix}
\medmath{\diffp{f_1}{x_1}} & \medmath{\diffp{f_1}{x_2}} \\
\medmath{\diffp{f_2}{x_1}} & \medmath{\diffp{f_2}{x_2}}
\end{pmatrix}
\]
\end{document}