[Tex/LaTex] How to expand equation to textwidth

math-modespacingwidth

I have an equation like so:

\begin{equation}
    \label{eq:helper_params}
    \tilde{B} = \begin{bmatrix} CB\\B \end{bmatrix}, \tilde{I} = \begin{bmatrix} I_p\\0 \end{bmatrix},
    \tilde{Q} = \begin{bmatrix} Q_e & 0\\0 & Q_x \end{bmatrix}, \tilde{A} = \begin{bmatrix} \tilde{I}\quad \tilde{F} \end{bmatrix}
\end{equation}

which produces this:


enter image description here


I would like to automatically expand the space between each matrix such that the whole equation fills the textwidth (or linewidth or any other predefined similar constant). I want to achieve something similar to this:


enter image description here


Are there any mechanisms for this goal?

Best Answer

You can abuse the flalign environment; here are two realizations, in the first one I don't use the whole available space by adding two empty blocks at either end.

However, my advice is to use just \quad or \qquad between the items, so as to ensure uniform spacing across the document. So I provide also the version with \qquad. In my opinion there's no battle.

\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum}
\begin{document}
\lipsum*[2]
\begin{flalign}
&&\tilde{B} = \begin{bmatrix} CB\\B \end{bmatrix},
&&\tilde{I} = \begin{bmatrix} I_p\\0 \end{bmatrix},
&&\tilde{Q} = \begin{bmatrix} Q_e & 0\\0 & Q_x \end{bmatrix},
&&\tilde{A} = \begin{bmatrix} \tilde{I} & \tilde{F} \end{bmatrix}
&&\label{eq:helper_params}
\end{flalign}
\lipsum*[3]
\begin{flalign}
\tilde{B} = \begin{bmatrix} CB\\B \end{bmatrix},
&&\tilde{I} = \begin{bmatrix} I_p\\0 \end{bmatrix},
&&\tilde{Q} = \begin{bmatrix} Q_e & 0\\0 & Q_x \end{bmatrix},
&&\tilde{A} = \begin{bmatrix} \tilde{I} & \tilde{F} \end{bmatrix}
\label{eq:helper_params1}
\end{flalign}
\lipsum*[4]
\begin{equation}
\tilde{B} = \begin{bmatrix} CB\\B \end{bmatrix}, \qquad
\tilde{I} = \begin{bmatrix} I_p\\0 \end{bmatrix}, \qquad
\tilde{Q} = \begin{bmatrix} Q_e & 0\\0 & Q_x \end{bmatrix}, \qquad
\tilde{A} = \begin{bmatrix} \tilde{I} & \tilde{F} \end{bmatrix}
\label{eq:helper_params3}
\end{equation}
\lipsum[5]

\end{document}

enter image description here