5

The picture below shows what I'm able to produce, but what I'd really like is to have the "coefficient" text aligned to the right (meaning that the tip of the \underbrace points to the 't') and the "variable" text aligned to the left (meaning that the tip of the second underbrace points tot the 'v'). Surely this is possible! [But I haven't figured out how ... I naively tried a [l] or [r] argument with \underbrace, but had no success.]

Here is a MWE (minimum working example) of my source that I have used with pdflatex:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

$$\overbrace{\underbrace{-\pi\vphantom{(y)}}_\text{coefficient}\underbrace{y^2\vphantom{(y)}}_\text{variable}}^\text{term}$$

\end{document} 

Horizontal alignment argument for 'subscript' of \underbrace

4

mathtools provides \mathrlap and \mathllap for overlapping content to the right/left. The following does that with some negative space to position the letters under the \underbrace tip:

enter image description here

\documentclass{article}
\usepackage{mathtools}% http://ctan.org/pkg/mathtools
\begin{document}
\[
  \overbrace{
    \underbrace{-\pi\vphantom{(y)}}_\text{coefficient}
    \underbrace{y^2\vphantom{(y)}}_\text{variable}}^\text{term}
\]


\[
  \overbrace{
    \underbrace{-\pi\vphantom{(y)}}_{\mathllap{\text{coefficient}\!}}
    \underbrace{y^2\vphantom{(y)}}_{\mathrlap{\!\text{variable}}}}^\text{term}
\]
\end{document} 
3

I interpreted your alignment request a little differently than did Werner. Not sure who read your thoughts correctly. You can change the gap between the \pi and the y...I used a \quad space. Obviously, if set to zero space, there also won't be any space between the end of "coefficient" and the beginning of "variable".

This approach uses an aligned stack to get the end of the under-word to line up with the end, not the middle, of the underbrace.

\documentclass{article}
\usepackage{stackengine}[2013-10-15]
\usepackage{amsmath}
\begin{document}
\[
\overbrace{\Shortunderstack[r]{$\underbrace{-\pi\vphantom{(y)}}$ 
  \scriptsize coefficient}\quad
\Shortunderstack[l]{$\underbrace{y^2\vphantom{(y)}}$ 
  \scriptsize variable}}^\text{term}
\]

\[
\overbrace{\Shortunderstack[r]{$\underbrace{-\pi\vphantom{(y)}}$ 
  \scriptsize\llap{coefficient}}\quad
\Shortunderstack[l]{$\underbrace{y^2\vphantom{(y)}}$ 
  \scriptsize\rlap{variable}}}^\text{term}
\]
\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.