# Alignment of labeled vector with other vectos

I would like create 3 line vectors that are directly aligned to each other. I would to label the first vector (here example A, B, C ...) However the alignment (and the size of the brackts does not really work out. Does someone have a suggestion on this?

\begin{align}
p_{A} &= \bordermatrix{~  & A & B & C & D & E & F & G & H \cr
~ & 0,01 & 0,49 & 0,02 & 0,00 & 0,01 & 0,26 & 0,1 & 0,11\cr} \\
p_{B} &= \begin{pmatrix}
0,10 & 0,17 & 0,65 & 0,01 & 0,01 & 0,02 & 0,01 & 0,03 \\
\end{pmatrix} \\
\end{align}


Would be great if you could help me on this

Best

• I think you shouldn't force it to be vector. Make a table instead of an ugly vectorish thing. – percusse Jan 15 '15 at 13:46

Here's one possibility, with TABstacks.

\documentclass{article}
\usepackage{amsmath,tabstackengine}
\setstackTAB{@}
\setstacktabbedgap{1em}% INTERCOLUMN GAP
\stackMath
\begin{document}
\begin{align}
p_{A} =\phantom{(} \tabbedstackon[5pt]% THE 5pt IS THE GAP TO THE OVERSET
{\llap{(}0,01 @ 0,49 @ 0,02 @ 0,00 @ 0,01 @ 0,26 @ 0,10 @ 0,11\rlap{)}}
{A @ B @ C @ D @ E @ F @ G @ H} \\
p_{B} = \phantom{(} \tabbedShortstack{
\llap{(}0,10 @ 0,17 @ 0,65 @ 0,01 @ 0,01 @ 0,02 @ 0,01 @ 0,03\rlap{)}}
\end{align}
\end{document}


The standard array environment is good, but if the entries are decimal numbers it's better to use siunitx.

\documentclass{article}
\usepackage{amsmath,array,siunitx}

\sisetup{output-decimal-marker={,}}

\begin{document}
First the version with the standard \texttt{array}
$$\begin{array}{r @{} *{8}{c} @{} l} & A & B & C & D & E & F & G & H \\ p_{A} = (& 0,01 & 0,49 & 0,02 & 0,00 & 0,01 & 0,26 & 0,10 & 0,11 &) \\ p_{B} = (& 0,10 & 0,17 & 0,65 & 0,01 & 0,01 & 0,02 & 0,01 & 0,03 &) \end{array}$$
and then the version with \texttt{siunitx}
$$\begin{array}{r @{} *{8}{S[table-format=1.2]} @{} l} & {A} & {B} & {C} & {D} & {E} & {F} & {G} & {H} \\ p_{A} = (& 0,01 & 0,49 & 0,02 & 0,00 & 0,01 & 0,26 & 0,10 & 0,11 &) \\ p_{B} = (& 0,10 & 0,17 & 0,65 & 0,01 & 0,01 & 0,02 & 0,01 & 0,03 &) \end{array}$$
\end{document}


If the two lines need to be numbered, then one can do it with the help of gather:

\begin{gather}
\nonumber\\
\\
\smash{
\begin{array}[b]{r @{} *{8}{S[table-format=1.2]} @{} l}
& {A}  & {B}  & {C}  & {D}  & {E}  & {F}  & {G}  & {H}     \\[\jot]
p_{A} = (& 0,01 & 0,49 & 0,02 & 0,00 & 0,01 & 0,26 & 0,10 & 0,11 &) \\[\jot]
p_{B} = (& 0,10 & 0,17 & 0,65 & 0,01 & 0,01 & 0,02 & 0,01 & 0,03 &)
\end{array}
}
\end{gather}


• Is there a way to get both $p_A$ and $p_B$ lines numbered? I was working on a similar solution but I couldn't find how to get both numbered as in the original code. – Paul Gessler Jan 15 '15 at 15:07
• @PaulGessler Added. – egreg Jan 15 '15 at 15:23