3

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?

9

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}
  • It seems I can use displaystyle in \overset as well! – YiFei Nov 13 '17 at 21:33
  • sadly, the baselines of the letters in the uppermost line aren't aligned vertically. that could be adjusted by adding a \mathstrut to each. – barbara beeton Nov 13 '17 at 21:34
  • @barbarabeeton - Great suggestion! I'll modify the first answer accordingly. – Mico Nov 13 '17 at 21:35
  • @YiFei - Using \displaystyle instead of \textstyle in the first argument of \myoverset will make a difference if the overset material contains superscripts and/or subscripts or if it contains "large" symbols such as \sum and \int. For the symbols x, y, and z, though, no change will occur. – Mico Nov 13 '17 at 21:39
5

You can use a bottom aligned array:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\adorn}[2]{\begin{array}[b]{@{}c@{}}#2\\#1\end{array}}

\begin{document}

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

\end{document}

enter image description here

4

Maybe something like this

\documentclass{article}
\usepackage{amsmath}

\newcommand{\Overset}[2]{%
  \mathop{#2}\limits^{\vbox to -.1ex{%
  \kern -1.4ex\hbox{$#1$}\vss}}}

\begin{document}

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

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

\begin{document}

enter image description here

As you can see, I have defined a new command called \Overset.

  • @Mico Please feel free to change my code to one of those solutions you propose. Be my guest! – Cragfelt Nov 13 '17 at 21:30
  • I've taken you on your offer. :-) – Mico Nov 13 '17 at 21:32
3

Here, stackengine is suited. One can change the stack baselineskip, as shown, with the \setstackgap invocation.

\documentclass{article}
\usepackage{stackengine}
\newcommand\mathstack[2]{\ensurestackMath{%
  \stackengine{\Lstackgap}{{}#1{}}{#2}{O}{c}{F}{F}{L}}}
\begin{document}
\[a = \langle a \mathstack{+}{x} b, c \mathstack{+}{y} d, e \mathstack{+}{z} f \rangle\]
\setstackgap{L}{1.3\baselineskip}
\[a = \langle a \mathstack{+}{x} b, c \mathstack{+}{y} d, e \mathstack{+}{z} f \rangle\]
\end{document}

enter image description here

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.