How to format a matrix system of equations in LATEX

By adding \vphantom{\dpartial{u}{p}} to elements of vector:

enter image description here

\documentclass{article}

\usepackage{amsmath}
    \newcommand{\dpartial}[2]{\frac{\partial #1}{\partial #2}}
\usepackage{etoolbox}
    \AtBeginEnvironment{bmatrix}{\everymath{\displaystyle}} % \displaystyle systems of equations

\begin{document}
 \begin{equation}
    \begin{bmatrix}
        m\dpartial{u}{T} & m\dpartial{u}{p} \\
        -m\left(T\dpartial{R}{T} + R\right) & V - mT\dpartial{R}{p}
    \end{bmatrix}
    %
    \begin{bmatrix}
        \dot{T}\vphantom{\dpartial{u}{p}} \\
        \dot{p}\vphantom{\dpartial{u}{p}}
    \end{bmatrix} =
    %
    \begin{bmatrix}
        \dot{Q} - p\dot{V} + \dot{m}(h-u) - m\dpartial{u}{\phi}\dot{\phi}  \\
        \dot{m}RT + mT\dpartial{R}{\phi}\dot{\phi} - p\dot{V}
    \end{bmatrix}
    \end{equation}
\end{document}

Addendum: Considering to @Mico comment, you will get better looking matrices and vector by inserting some vertical space between their rows. This you can achieve on many ways, for example:

  • by terminate rows with \\[2ex]
  • by inserting \addlinespace determined in the booktabs package:
\documentclass{article}
\usepackage{booktabs}

\usepackage{amsmath}
    \newcommand{\dpartial}[2]{\frac{\partial #1}{\partial #2}}
\usepackage{etoolbox}
    \AtBeginEnvironment{bmatrix}{\everymath{\displaystyle}} % \displaystyle systems of equations

\begin{document}
 \begin{equation}
    \begin{bmatrix}
        m\dpartial{u}{T} & m\dpartial{u}{p} \\
        \addlinespace
        -m\biggl(T\dpartial{R}{T} + R\biggr) & V - mT\dpartial{R}{p}
    \end{bmatrix}
    %
    \begin{bmatrix}
        \dot{T}\vphantom{\dpartial{u}{p}} \\
        \addlinespace
        \dot{p}\vphantom{\dpartial{u}{p}}
    \end{bmatrix} =
    %
    \begin{bmatrix}
        \dot{Q} - p\dot{V} + \dot{m}(h-u) - m\dpartial{u}{\phi}\dot{\phi}  \\
        \addlinespace
        \dot{m}RT + mT\dpartial{R}{\phi}\dot{\phi} - p\dot{V}
    \end{bmatrix}
    \end{equation}
\end{document}

enter image description here

  • by use of \makegapedcells defined in the makecell package:
\documentclass{article}
\usepackage{makecell}

\usepackage{amsmath}
    \newcommand{\dpartial}[2]{\frac{\partial #1}{\partial #2}}
\usepackage{etoolbox}
    \AtBeginEnvironment{bmatrix}{\everymath{\displaystyle}} % \displaystyle systems of equations

\begin{document}
 \begin{equation}
\setcellgapes{5pt}
\makegapedcells
    \begin{bmatrix}
        m\dpartial{u}{T} & m\dpartial{u}{p} \\
        -m\biggl(T\dpartial{R}{T} + R\biggr) & V - mT\dpartial{R}{p}
    \end{bmatrix}
    %
    \begin{bmatrix}
        \dot{T}\vphantom{\dpartial{u}{p}} \\
        \dot{p}\vphantom{\dpartial{u}{p}}
    \end{bmatrix} =
    %
    \begin{bmatrix}
        \dot{Q} - p\dot{V} + \dot{m}(h-u) - m\dpartial{u}{\phi}\dot{\phi}  \\
        \dot{m}RT + mT\dpartial{R}{\phi}\dot{\phi} - p\dot{V}
    \end{bmatrix}
    \end{equation}
\end{document}

enter image description here