矩陣中元素周圍的填充

矩陣中元素周圍的填充

是否可以調整矩陣中元素周圍的填充,如下圖所示。

狹窄矩陣的範例

程式碼如下所示

\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 套件來簡化偏導數的輸入,以及命令\medmathfromnccmath在矩陣中包含中等大小的分數(預設為\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} 

在此輸入影像描述

相關內容