Put two matrices on top of each other

matrices

This code

\begin{bmatrix} 
        a_{11} & a_{12} & a_{13} & a_{14} \\
        a_{21} & a_{22} & a_{23} & a_{24} \\
        a_{31} & a_{32} & a_{33} & a_{34} 
    \end{bmatrix}
    \begin{bmatrix}
        5 & 6 & 7 & 8 \\
        4 & 3 & 2 & 1 \\
        6 & 7 & 8 & 9 
    
    \end{bmatrix}

generates two matrices side by side.
How can I make them on top of each other?

Best Answer

I suggest you place both bmatrix environments inside a gather* environment.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for 'bmatrix' and 'gather*' environments

\begin{document}
\begin{gather*}
\begin{bmatrix} 
        a_{11} & a_{12} & a_{13} & a_{14} \\
        a_{21} & a_{22} & a_{23} & a_{24} \\
        a_{31} & a_{32} & a_{33} & a_{34} 
\end{bmatrix} \\ % <-- force a line break
\begin{bmatrix}
        5 & 6 & 7 & 8 \\
        4 & 3 & 2 & 1 \\
        6 & 7 & 8 & 9  
\end{bmatrix}
\end{gather*}
\end{document}