# Underbrace under sqrt content

I am trying to use underbrace to clarify the arguments to a sqrt. However this causes the square root sign to reach all the way down to the bottom of the text under the brace(s), which is not what I want.

MWE:

\documentclass{article}
\usepackage{mathtools}

\begin{document}

$\sqrt{\underbrace{\frac{1}{\tau}\underbrace{\int_{\text{-}\infty}^{t}\underbrace{p_{X}^{\,2}\left(\xi\right)\cdot e^{\frac{\text{-}\left(t\text{-}\xi\right)}{\tau}}}_{\substack{\text{Expontial}\\\text{time-weighting}\\\text{of$p_{X}^{\,2}\left(\xi\right)$}}} \,\mathrm{d}\xi}_{\text{Exponential integration}}}_{\substack{\text{Exponential averaging}\\\text{= “Quasi mean-square”}}}}$

\end{document}

This results in something line this:

Does anyone know how I can force sqrt to reach only as low as its "real" (mathematically speaking) argument?

-

I would recommend Mico's way; if you really want the surd, then here is a solution that takes all the vertical space it needs (not like in wh1t3's answer):

\documentclass{article}
\usepackage{mathtools}

\def\sqrtexplained#1{%
\begingroup
\sbox0{$#1$}
\def\underbrace##1_##2{##1}
\sbox2{$#1$}
\mathrlap{\sqrt{\phantom{\displaystyle#1}\kern\dimen0 }}
\hphantom{\sqrt{\vphantom{\displaystyle#1}}}
\endgroup
#1}

\begin{document}

$\sqrtexplained{% \underbrace{\frac{1}{\tau} \underbrace{\int_{-\infty}^{t} \underbrace{p_{X}^{2}(\xi)\cdot e^{\frac{-(t-\xi)}{\tau}}} _{\substack{\text{Exponential}\\ \text{time-weighting}\\ \text{of p_{X}^{2}(\xi)}} } \,\mathrm{d}\xi} _{\text{Exponential integration}}} _{\substack{\text{Exponential averaging}\\ =\text{Quasi mean-square}} } }$

\end{document}


I've also corrected the input errors you are making: \text{-} for a minus sign is wrong; \left and \right should be used only when they are really needed.

-
Works great, thanks! However, is it possible you forgot a \makeatother? – Matthias Oct 25 '11 at 12:35
@Matthias Delete the \makeatletter, it's not needed (I already did in the answer). – egreg Oct 25 '11 at 12:36

I would suggest that you not use the \sqrt{...} symbolism at all because it adds yet another horizontal bar to an expression that's already very busy-looking. Instead, I suggest you write something like:

\documentclass{article}
\usepackage{concrete,eulervm,mathtools}
\begin{document}
$\biggl(\, \underbrace{\frac{1}{\tau} \underbrace{\int\limits_{-\infty}^{t} \underbrace{p_{X}^{\,2} (\xi) \cdot e^{-(t-\xi)/\tau}} _{\substack{\text{Exponential time-}\\ \text{weighting of$p_{X}^{\,2}(\xi)$}}} \,d\xi} _{\text{Exponential integration}}} _{\substack{\text{Exponential averaging}\\ \text{$=$Quasi mean-square''}}} \,\biggr)^{1/2}$
\end{document}


-
 I considered doing it like that, but because I use square root signs elsewhere in the document I would prefer to do so here as well for consistency. – Matthias Oct 25 '11 at 12:14

You can use \smash and a \vphantom to make it work.

\documentclass{article}
\usepackage{mathtools}
\begin{document}

$\sqrt{\vphantom{\int_{\text{-}\infty}^{t}x}\smash{ \underbrace{ \frac{1}{\tau} \underbrace{ \int_{\text{-}\infty}^{t} \underbrace{ p_{X}^{\,2}\left(\xi\right)\cdot e^{\frac{\text{-}\left(t\text{-}\xi\right)}{\tau}} }_{\substack{\text{Expontial}\\\text{time-weighting}\\\text{of p_{X}^{\,2}\left(\xi\right)}}} \,\mathrm{d}\xi }_{\text{Exponential integration}} }_{\substack{\text{Exponential averaging}\\\text{= “Quasi mean-square”}}} }}$

\end{document}


The output looks like this:

I should note that this does not appear to work in inline math-mode. The size of the vphantom does not correctly reflect the integral sign then. Perhaps someone else can explain why this is the case, since I don't know.

Edit after @egreg's comment, an additional vphantom should be added, to ensure the displaymath gets the height of the braces as well. The modified code would look like this:

\documentclass{article}
\usepackage{mathtools}
\begin{document}

$\sqrt{\vphantom{\int_{\text{-}\infty}^{t}x}\smash{ \underbrace{ \frac{1}{\tau} \underbrace{ \int_{\text{-}\infty}^{t} \underbrace{ p_{X}^{\,2}\left(\xi\right)\cdot e^{\frac{\text{-}\left(t\text{-}\xi\right)}{\tau}} }_{\substack{\text{Expontial}\\\text{time-weighting}\\\text{of p_{X}^{\,2}\left(\xi\right)}}} \,\mathrm{d}\xi }_{\text{Exponential integration}} }_{\substack{\text{Exponential averaging}\\\text{= “Quasi mean-square”}}} }} \vphantom{\underbrace{ \frac{1}{\tau} \underbrace{ \int_{\text{-}\infty}^{t} \underbrace{ p_{X}^{\,2}\left(\xi\right)\cdot e^{\frac{\text{-}\left(t\text{-}\xi\right)}{\tau}} }_{\substack{\text{Expontial}\\\text{time-weighting}\\\text{of p_{X}^{\,2}\left(\xi\right)}}} \,\mathrm{d}\xi }_{\text{Exponential integration}} }_{\substack{\text{Exponential averaging}\\\text{= “Quasi mean-square”}}} }$

A long sentence after it to see if there are problems with overruning.

\end{document}


And its output like this:

-
 An added \displaystyle ought to do it. – Niel de Beaudrap Oct 25 '11 at 12:02 @NieldeBeaudrap yes, I gathered that from Stefan's answer as well. Why is this the case though? The actual integral in the formula is not set in displaystyle, so why would it need the additional height in the vphantom, when it clearly does not require it for the actual formula? – Roelof Spijker Oct 25 '11 at 12:05 This doesn't give the formula its real vertical size; subsequent text will be superposed to it. – egreg Oct 25 '11 at 12:21 @egreg you are absolutely right, added a vphantom to handle this. – Roelof Spijker Oct 25 '11 at 12:24

If you would like to have nice looking braces then you can use the following brute force method.

\documentclass{article}
\usepackage{mathtools}
\usepackage{pstricks}
$$\sqrt{\frac{1}{\tau}\int_{-\infty}^{t} p_{X}^{2}(\xi)\cdot e^{t-\xi}d\xi}$$