矩陣環境中的垂直間距:我怎麼能有相同的?

矩陣環境中的垂直間距:我怎麼能有相同的?

這是我的問題:我試著將雅可比矩陣寫為另外兩個矩陣的乘積,但結果是錯誤的,因為它們沒有相同的高度。這是我的程式碼:

\documentclass[11pt]{book}
\usepackage{amsmath}
\begin{document}

\begin{align*}
   Jac(f \circ \varphi)_{x_0} =& Jac(f)_{\varphi(x_0)} Jac(\varphi)_{x_0} \\
   =& \begin{pmatrix}
     \frac{\partial f}{\partial x}(r \cos(\theta), r \sin(\theta)) \\
     \frac{\partial f}{\partial y}(r \cos(\theta), r \sin(\theta))
   \end{pmatrix} \begin{pmatrix}
     \cos(\theta) & -r \sin(\theta) \\
     \sin(\theta) & r \cos(\theta)
   \end{pmatrix}
 \end{align*}
\end{document}

我不想使用 /em 那樣的技巧。你有解決辦法嗎?謝謝 !

答案1

我不會堅持矩陣具有相同的高度;相反,我會使用\dfrac內部偏導數並稍微隔開行;請參閱第二條路線是否具有相同的高度。

\documentclass[11pt]{book}
\usepackage{amsmath}
\DeclareMathOperator{\Jac}{Jac}

\begin{document}

\begin{align*}
\Jac(f \circ \varphi)_{x_0} 
&= \Jac(f)_{\varphi(x_0)} \Jac(\varphi)_{x_0} \\
&= \begin{pmatrix}
   \dfrac{\partial f}{\partial x}(r \cos(\theta), r \sin(\theta)) \\[3ex]
   \dfrac{\partial f}{\partial y}(r \cos(\theta), r \sin(\theta))
   \end{pmatrix}
   \begin{pmatrix}
   \cos(\theta) & -r \sin(\theta) \\[2ex]
   \sin(\theta) & r \cos(\theta)
   \end{pmatrix}
\end{align*}
\begin{align*}
\Jac(f \circ \varphi)_{x_0} 
&= \Jac(f)_{\varphi(x_0)} \Jac(\varphi)_{x_0} \\
&= \begin{pmatrix}
   \frac{\partial f}{\partial x}(r \cos(\theta), r \sin(\theta)) \\[1ex]
   \frac{\partial f}{\partial y}(r \cos(\theta), r \sin(\theta))
   \end{pmatrix}
   \begin{pmatrix}
   \cos(\theta) & -r \sin(\theta) \\[1ex]
   \sin(\theta) & r \cos(\theta)
   \end{pmatrix}
\end{align*}
\end{document}

請注意數學運算符的用法以及正確的&=而不是=&

在此輸入影像描述

答案2

使用套件\mfrac中的(中等大小的部分)可以nccmath為矩陣提供更合理的大小。我認為更糟糕的(從美學上來說)是讓線條幾乎對齊,所以你必須在第二個矩陣的行之間手動添加一些空間,如果你改變字體,甚至字體大小,你可能會再次調整一切。

將有一種自動方式來精確對齊矩陣,使用該 blkarray套件並僅寫入 1 個帶有分隔符號的矩陣。然而它有一些缺陷:它不能很好地與對齊配合使用,因此,例如對齊點(=)必須寫成before&符號。不管怎樣,下面的程式碼展示了這兩種方法。我還使用該 cellspace套件來簡化矩陣中的行(不適用於 blkarray):

    \documentclass[11pt, leqno]{book}
    \usepackage[utf8]{inputenc}
    \usepackage{amsmath}

    \DeclareMathOperator{\Jac}{Jac}
    \usepackage{blkarray}
    \usepackage{nccmath}
    \usepackage[math]{cellspace}
    \cellspacetoplimit = 3pt
    \cellspacebottomlimit = 3pt

    \begin{document}

    \begin{align*}
     \Jac(f \circ \varphi)_{x_0} =&\Jac(f)_{\varphi(x_0)} \Jac(\varphi)_{x_0} \\
    \tag*{\small manual adjustment:}           =& \begin{pmatrix}
         \mfrac{\partial f}{\partial x}(r \cos(\theta), r \sin(\theta)) \\
         \mfrac{\partial f}{\partial y}(r \cos(\theta), r \sin(\theta))
       \end{pmatrix} \begin{pmatrix}
         \cos(\theta) & -r \sin(\theta) \\[6pt]
         \sin(\theta) & r \cos(\theta)
       \end{pmatrix}
       \\%
    \tag*{\small with blkarray:}       = &{\ } \begin{blockarray}[t]{(c)!{\ }(cc)}
        \mfrac{\partial f}{\partial x}(r \cos(\theta), r \sin(\theta)) &  \cos(\theta) & -r \sin(\theta)\\[8pt]
         \mfrac{\partial f}{\partial y}(r \cos(\theta), r \sin(\theta)) & \sin(\theta) & r \cos(\theta)
        \end{blockarray}
     \end{align*}

    \end{document} 

在此輸入影像描述

相關內容