행렬의 요소 주위 채우기

행렬의 요소 주위 채우기

아래 그림에 표시된 대로 행렬의 요소 주위 패딩을 조정할 수 있습니까?

비좁은 매트릭스의 예

코드는 아래와 같습니다

\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} 

여기에 이미지 설명을 입력하세요

관련 정보