# Matrix align within equation

From my code below, how do I:

1. increase the spacing between the rows (as the denominator of the top fraction is too close to the numerator of the bottom fraction).

2. reduce the spacing between the '+' signs

Here is my code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{arydshln}

\begin{document}

$$\dfrac{d\mathbf{P}_{T}}{dt} = {\begin{pmatrix} \dfrac{dx}{dt} \\ \dfrac{dy}{dt} \\ \dfrac{dz}{dt} \end{pmatrix}} ={\begin{pmatrix} \dfrac{dx}{d\theta_{1}} \dfrac{d\theta_{1}}{dt} & + & \dfrac{dx}{dr_{2}} \dfrac{dr_{2}}{dt} & + & \dfrac{dx}{dr_{3}} \dfrac{dr_{3}}{dt}\\ \dfrac{dy}{d\theta_{1}} \dfrac{d\theta_{1}}{dt} & + & \dfrac{dy}{dr_{2}} \dfrac{dr_{2}}{dt} & + & \dfrac{dy}{dr_{3}} \dfrac{dr_{3}}{dt} \\ 0 && 0 && 0 \end{pmatrix}}$$

\end{document}

• There is no need to add braces around \begin{pmatrix} and \end{pmatrix}. Oct 7, 2015 at 20:46

\documentclass{article}
\usepackage{amsmath}
\usepackage{arydshln}

\begin{document}

$$\dfrac{d\mathbf{P}_{T}}{dt} = {\begin{pmatrix} \dfrac{dx}{dt} \\[2.5ex] \dfrac{dy}{dt} \\[2.5ex] \dfrac{dz}{dt} \end{pmatrix}} ={\begin{pmatrix} \dfrac{dx}{d\theta_{1}} \dfrac{d\theta_{1}}{dt} + \dfrac{dx}{dr_{2}} \dfrac{dr_{2}}{dt} + \dfrac{dx}{dr_{3}} \dfrac{dr_{3}}{dt}\\[2.5ex] \dfrac{dy}{d\theta_{1}} \dfrac{d\theta_{1}}{dt} + \dfrac{dy}{dr_{2}} \dfrac{dr_{2}}{dt} + \dfrac{dy}{dr_{3}} \dfrac{dr_{3}}{dt} \\[2.5ex] 0 \hspace{1.3cm} 0 \hspace{1.3cm} 0 \end{pmatrix}}$$

\end{document}

1. See some of the examples listed in Column and row padding in tables. I've adjusted \arraystretch below;

2. Remove the column spacing (by setting \arraycolsep to 0pt) and then force + to be set as a binary operator using {}+{}.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$$\renewcommand{\arraystretch}{2}% increase spacing between rows \dfrac{d\mathbf{P}_{T}}{dt} = {\begin{pmatrix} \dfrac{dx}{dt} \\ \dfrac{dy}{dt} \\ \dfrac{dz}{dt} \end{pmatrix}} = \setlength{\arraycolsep}{0pt}% remove spacing between columns \begin{pmatrix} \dfrac{dx}{d\theta_{1}} \dfrac{d\theta_{1}}{dt} & {}+{} & \dfrac{dx}{dr_{2}} \dfrac{dr_{2}}{dt} & {}+{} & \dfrac{dx}{dr_{3}} \dfrac{dr_{3}}{dt} \\ \dfrac{dy}{d\theta_{1}} \dfrac{d\theta_{1}}{dt} & {}+{} & \dfrac{dy}{dr_{2}} \dfrac{dr_{2}}{dt} & {}+{} & \dfrac{dy}{dr_{3}} \dfrac{dr_{3}}{dt} \\ 0 && 0 && 0 \end{pmatrix}$$

\end{document}