[Tex/LaTex] How to stack a symbol on another of same size but with no vertical centering

formattingmath-modestacking-symbols

I have something like

\[a = \langle a + b, c + d, e + f \rangle\]

But I want to stack another vector right above the right hand side, centered horizontally (with respect to corresponding elements of a), but without angle brackets, namely

        x      y      z
a = < a + b, c + d, e + f >

I tried \overset but it's not satisfactory because the upper vector will be smaller. I also tried \genfrac but it pushes the original vector down. (I don't want the angle brackets to extend to cover two lines.) How can I achieve this?

Best Answer

Here are two possible solutions. The first uses a modified form of the \overset macro, in which the first argument is set in \textstyle rather than the default \scriptstyle. The second uses an array environment; it requires a bit more setup, but it's more flexible/versatile than the first. E.g., it's more straightforward changing the vertical spacing when using the second method.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\newcommand\myoverset[2]{\overset{\textstyle #1\mathstrut}{#2}}
\newcommand\mycomma{,\mkern3mu} % emulate punctuation spacing
\begin{document}

\[
a = \langle \myoverset{x}{a + b}, 
            \myoverset{y}{c + d}, 
            \myoverset{z}{e + f} \rangle
\]

\[
\setlength{\arraycolsep}{0pt}
\begin{array}{ccccccc}
&x && y && z &\\
a=\langle &a+b &\mycomma& c+d &\mycomma& e+f &\rangle
\end{array}
\]

\end{document}