I have aligned display equations similar to the following example. I'm using words as placeholders here, but they are actually mathematical expressions:
\begin{gather}
\begin{alignedat}{3}
(& \text{dolor} && +\text{adipiscing} && +\text{amet} \\
& \text{consectetur} && -\text{sit} && -\text{elit} && )
\end{alignedat}
\end{gather}
I want to add an underbrace to each alignment column. In other words, there are three groups of terms, each consisting of one term in the first and one in the second row:
\begin{gather}
\begin{alignedat}{3}
(& \text{dolor} && +\text{adipiscing} && +\text{amet} \\
& \underbrace{\text{consectetur}}_{\text{first}}
&& \underbrace{-\text{sit}}_{\text{second}}
&& \underbrace{-\text{elit}}_{\text{third}} && )
\end{alignedat}
\end{gather}
Each underbrace only spans the width of its term in the second row. Instead, I would like to place an underbrace that spans the widest term in its align column, indicating that it applies to all terms in this column. Here is a photoshop example:
Is this possible in a generic way, i.e. without having to manually create phantom elements of the longest term of each column for every such equation block?