Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to stay in math mode by using $ delimiters. But when I use this code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}

$\big(\sum_{j=1}^n\delta_{j,k}x_k\big)_{1\leq k\leq n}
=\big(\underbrace{\sum_{j=1}^n\delta_{j,k}}_{1_A}x_k\big)_{1\leq k\leq n}$

\end{document}

I get this:

enter image description here

On the right, it looks as if I was in displaymath. Why? Should I use \textstyle whenever I use \underbrace?

share|improve this question
1  
why do you want this expression to be inline math rather than display? –  David Carlisle Mar 14 at 16:51
    
When you add an underbrace, it increases the depth of the expression so much that there is almost a guarantee of uneven linespacing below it. Because of this, it is a "(not unreasonable) assum[p]tion" (to quote D.Carlisle) for \underbrace to expect it has been used in a display, where that extra vertical space is not a problem. –  Dan Mar 14 at 18:44
    
@Dan feel free to edit my typos (I fixed that one thanks:-) –  David Carlisle Mar 14 at 20:42

2 Answers 2

underbrace is defined in the latex format as

\def\underbrace#1{\mathop{\vtop{\m@th\ialign{##\crcr
   $\hfil\displaystyle{#1}\hfil$\crcr
          %%%%%%%%%%%%
   \noalign{\kern3\p@\nointerlineskip}%
   \upbracefill\crcr\noalign{\kern3\p@}}}}\limits}

There is a (not unreasonable:-) assumption that no one would want textstyle here. So if you really do want that you would have to re-assert it in the argument as you suggest in your question.

share|improve this answer
2  
+1 for "not unreasonable". –  T. Verron Mar 14 at 16:48

So given that David has told you why it is that way, there are several things you can do with that information. You can create your own macro \tunderbrace that is just like \underbrace but in text style, by altering the existing definition.

Or you, just for fun, create your own version, \Tunderbrace, using stacks:

\documentclass{article}
\usepackage{stackengine, scalerel, graphicx}
\makeatletter
\def\tunderbrace#1{\mathop{\vtop{\m@th\ialign{##\crcr
   $\hfil\textstyle{#1}\hfil$\crcr
          %%%%%%%%%%%%
   \noalign{\kern3\p@\nointerlineskip}%
   \upbracefill\crcr\noalign{\kern3\p@}}}}\limits}
\makeatother
\newcommand\Tunderbrace[2]{\mathop{\ensurestackMath{%
  \def\tmp{#1}%
  \setbox0=\hbox{$\tmp$}%
  \stackunder[1pt]{%
    \stackunder[0pt]{\tmp}{\rotatebox{90}{\scaleto[2ex]{\{}{\wd0}}}%
  }{%
    \scriptstyle #2%
  }%
}}}
\parskip 1em
\begin{document}
$\tunderbrace{\sum_{j=1}^n \delta_{j,k}}_{1_A}x_k$\par
$\Tunderbrace{\sum_{j=1}^n \delta_{j,k}}{1_A}x_k$
\end{document}

enter image description here

share|improve this answer
    
Or you could set the entire expression in display math:-) –  David Carlisle Mar 14 at 17:21
    
Good point..... –  David Carlisle Mar 14 at 17:29
    
Oh you deleted it just as I was agreeing:-) –  David Carlisle Mar 14 at 17:30
    
@DavidCarlisle You are not being "not unreasonable", are you? Or maybe you are, when I work my way through the triple-negation. Oh, my head hurts. –  Steven B. Segletes Mar 14 at 17:31
1  
@StevenB.Segletes You don't really need something as powerful as stackengine to define a macro like \newcommand\tunderbrace[1]{\underbrace{\textstyle{#1}}} –  Dan Mar 14 at 18:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.