# Vertically aligned \underbracket's in an equation

$\underbracket[0.5pt]{\left( \begin{array}{c} a \\ b \end{array} \right)}_{v_1} \qquad \underbracket[0.5pt]{\left( \begin{array}{c} a \\ b \\ c \end{array} \right)}_{v_2}$


gives

I would like both brackets to lie on the same line, i.e., sthg like

-
 See also Enforcing baseline alignment for multiple overbraces in math mode (possible duplicate?) – Hendrik Vogt Mar 14 at 13:41 @HendrikVogt: Thanks for the link. I thought about vphantom. However, I am looking for another solution that works in more complicated examples? – user7064 Mar 14 at 13:43 @user7064 It may be possible to produce a more general solution to the baseline-alignment problem, but you need to explain what you mean by more "complicated examples". – Jubobs Mar 14 at 14:10 @Jubobs: I have an equation that combines several vectors and matrices (of different lengths/dimensions). Using \vphantom might be possible, but will result in awfull code... – user7064 Mar 14 at 14:14

use

\underbracket[0.5pt]{\left(
\begin{array}{c}
a \\
b
\end{array}
\right)
\vphantom{\left(\begin{array}{c}a \\b \\c\end{array}\right)}
}_{v_1}


EDIT: This might work

\begin{equation*}
\begin{matrix}
\begin{pmatrix}
a \\ b
\end{pmatrix}
&
\begin{pmatrix}
a \\ b \\c
\end{pmatrix}
\$-1em] \underbracket[0.5pt]\qquad_{v1} & \underbracket[0.5pt]\qquad_{v2} \end{matrix} \end{equation*}  (anyone know how to get dvipng to not to cut off so tightly?) -  @Thanks +1. Is there another solution than vphantom? – user7064 Mar 14 at 13:45 Not really. The problem is that the fences (the ()'s) are symetric about the math centerline, thus we cannot just use the [b] option for array – daleif Mar 14 at 14:37 Thx, I will try and probably accept thereafter – user7064 Mar 14 at 15:45 @daleif using [b] with delimiters is where delarray comes in:-) – David Carlisle Mar 14 at 17:29 Please always post complete documents showing all packages used. (I only got mathtools due to other answers) \documentclass{article} \usepackage{delarray,mathtools} \begin{document} \[ \underbracket[0.5pt]{ \begin{array}[b]({c}) a \\ b \end{array} }_{v_1} \qquad \underbracket[0.5pt]{ \begin{array}[b]({c}) a \\ b \\ c \end{array} }_{v_2}$

\end{document}

-
That was the package I had forgotten. I was messing with blockarray. Is delarray compatible with the array package and this memoir? – daleif Mar 14 at 18:22
@daleif delarray uses array (actually delarray is a bit of array we decided not to put into the latex2e version of array) no reason why it shouldn't work with memoir – David Carlisle Mar 14 at 18:57

Following the OP's comment regarding the lack of automation in the solutions proposed so far, I propose this:

1. define a command called \tallestmathstuff corresponding to the tallest mathematical "object" in your equation; some trial and error is necessary to make sure that it actually corresponds to the tallest thing.
2. define a command called \myunderbracket, which is build on \underbracket but inserts the \vphantom{\tallestmathstuff} before the first argument.

Then, using \myunderbracket instead of \underbracket prevents unnecessary clutter (i.e. \vphantom's) in the code.

\documentclass{article}
\usepackage{mathtools}

\begin{document}

$$\newcommand\tallestmathstuff{% % % Put your tallest math object here \begin{bmatrix} 1\\ 2\\ 3 \end{bmatrix} % }% \def\myunderbracket#1_#2{% \underbracket{\vphantom{\tallestmathstuff} #1}_{#2} } % \myunderbracket{ \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ \end{bmatrix} }_{A} \myunderbracket{\tallestmathstuff}_{x} = \myunderbracket{ \begin{bmatrix} 1 \\ 2 \end{bmatrix} }_{b}$$

\end{document}


EDIT: I have updated my solution so that \myunderbracket can be used exactly like \underbracket.

-
 But this is still using phantoms and requires hand specification of the largest entry, isn't that less automation than the delarray version? – David Carlisle Mar 14 at 21:32 @DavidCarlisle I think the OP wants centered vertical alignment. Can that be done with the delarray package? – Jubobs Mar 15 at 0:24 Does (s)he? don't get that directly with delarray, no:-) – David Carlisle Mar 15 at 0:30