4

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!

  • 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 Apr 29 '18 at 21:12
4

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

  • 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 Apr 30 '18 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 Apr 30 '18 at 0:39
5

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

  • 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 Apr 29 '18 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 Apr 29 '18 at 21:45
  • All the credit goes to cmhughes ! – BambOo Apr 29 '18 at 22:30

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.