5

Consider the following MWE:

\documentclass{article}
\usepackage{amsmath,stackengine}
\stackMath
\begin{document}
\renewcommand\useanchorwidth{T}
\begin{equation*}
\left( 0, \ldots, \underbrace{e_j}_\text{$i$-th postion}, \ldots, 0 \right)
\end{equation*}
\end{document}

This produces the following output:

enter image description here

The problem is that I followed Steven B. Segletes' solution in Underbrace changing spacing of operators in order to prevent the underbrace text from messing with the horizontal spacing of the surrounding ldots. Does anyone know what I've done wrong?

And I'd also like the parentheses to ignore the underbrace text with regards to automatic vertical sizing; I'm not sure if I should put that in a separate question because I'm new to the site!

1
  • The issue is that the _\text{$i$-th postion} increases the space around e_j so if you only type _\text{i} for instance, you have less horizontal spacing.
    – BambOo
    Commented Apr 29, 2018 at 21:12

2 Answers 2

6

I propose one of these solutions, more elegant from my point of view, than an oversized \underbrace. They're based respectively on the \underbracket command from mathtools, or on the \bclap command from stackengine.

\documentclass{article}
\usepackage{mathtools}
\usepackage[usestackEOL]{stackengine}

\begin{document}

\begin{equation*}
\bigl( 0, \ldots,  \underbracket[0.4pt]{e_j}_{\clap{\scriptsize$i$-th position}}, \ldots, 0 \bigr)\vspace*{3ex}
\end{equation*}

Some text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. 
\begin{equation*}
\bigl( 0, \ldots, e_{\stackMath\bclap{\substack{\boldsymbol{\vert}\\\text{\scriptsize $ i $-th position}}}j}, \ldots, 0 \bigr)
\end{equation*}
Some text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. 

\end{document} 

enter image description here

2
  • This is indeed elegant; and it answers the question I forgot to ask of how to replace the underbrace with an arrow. :) Fantastic answer.
    – Ergodica
    Commented Apr 30, 2018 at 0:24
  • Thanks for your kind appreciation. I've simplified the code of the first solution, as the exterior parentheses size depends no more of a\left...right` pair. No more smashing required.
    – Bernard
    Commented Apr 30, 2018 at 0:39
6

The solution you proposed links towards what you need.

See the code below with the corrections to get what you need (corrected horizontal spacing + setup of parentheses)

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation*}
\left( 0, \ldots, \underbrace{e_j}_\text{$i$-th postion}, \ldots, 0 \right)
\end{equation*}
% Corrects spacing issue
\begin{equation*}
\left( 0, \ldots, \underbrace{e_j}_{\mathclap{\text{$i$-th postion}}}, \ldots, 0 \right)
\end{equation*}
% Manual set up of parentheses
\begin{equation*}
\bigl( 0, \ldots, \underbrace{e_j}_{\mathclap{\text{$i$-th postion}}}, \ldots, 0 \bigr)
\end{equation*}
\end{document}

enter image description here

3
  • 1
    This is fantastic! Thanks so much. I wish there a way to still use \left( \right) and somehow tell it autoscale but ignore a certain part.
    – Ergodica
    Commented Apr 29, 2018 at 21:23
  • +1 for \mathclap wich emiminates text width. The second issue would equaly be fixed by using also \smash which suppresses the text height ?!
    – Jhor
    Commented Apr 29, 2018 at 21:45
  • All the credit goes to cmhughes !
    – BambOo
    Commented Apr 29, 2018 at 22:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .