6

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?

  • 5
    Instead of creating huge white gaps between the "blocks" of the equation, you may be better off inserting a standard spacer such as \quad after each of the three commas. – Mico Oct 5 '13 at 11:42
  • @Mico I fully agree (see my answer). – egreg Oct 5 '13 at 11:47
  • @Mico, you are right. But the point is using quad not necessarily satisfies what I want. Imagine if there were three matrices in my example above. In that case \quad would make nice spacing but it wouldn't fill the whole line. – Pouya Oct 5 '13 at 14:30
  • 1
    You should not be using flexible space to do the spacing. It is more pleasing to the eye that these spacings comes in fixed amounts. – daleif Oct 5 '13 at 15:12
  • Thanks. I suppose the solution that's best for you depends on whether you want maximal or simply consistent spacing between the items in the display equation. – Mico Oct 5 '13 at 15:36
7

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

  • What do you think about: \makeatletter \newenvironment{xxxalignat}{% \start@align\tw@\st@rredfalse }{% \endalign } \makeatother? – Marco Daniel Oct 5 '13 at 11:53
  • @MarcoDaniel I wouldn't bother: as I said, the third way easily wins when compared to the "automatic expansion" ones. – egreg Oct 5 '13 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.