I suggest using an explicit size rather than \left
and \right
.
It is possible to use \left
and \right
, though, by typesetting the material three times: one smashed, one with the underbrace suppressed and one for reestablishing the correct height of the material.
I also recommend other changes:
it's better to have a personal command for the expectation; if a reviewer pops up and orders you to typeset the “E” in a fancier font, you'll be able to do it by just changing one line of code;
the same holds for the differential sign; a journal you try to submit your paper to might want the “d” to be upright (unfortunately some do); with a personal command it's easier to comply; also, this \diff
automatically adds the thin space when needed;
don't use \underbrace
(or \overbrace
) in your document: in this case it doesn't really matter (for the \postsmash
macro to work it does, however), but in general it can lead to bad spacing;
when you're making the final revision, check the output for places where to add \,
or \!
in order to fix clashes.
\documentclass[12pt]{article}
\usepackage{mathtools,amssymb,amsthm}
\usepackage{lipsum} % for mock text
\DeclarePairedDelimiter{\expectationargument}{[}{]}
\newcommand{\expect}{E\expectationargument}
\newcommand{\diff}{\mathop{}\!d}
\newcommand{\ubrace}[2]{{% note the additional brace
\underbrace{#1}_{#2}%
}}
\makeatletter
\newcommand{\postsmash}[1]{%
\smash{#1}%
\vphantom{\let\ubrace\@firstoftwo#1}%
\gdef\fixverticalspace{\vphantom{#1}}%
}
\makeatother
\begin{document}
\lipsum[1][1-4]
\begin{equation*}
\expect[\Big]{\ubrace{\int_0^t v^2(s) \diff s}{\text{deterministic}}}
\qquad
\expect[\bigg]{\,\ubrace{\int_0^t v^2(s) \diff s}{\text{deterministic}}\,}
\end{equation*}
\lipsum[2][1-4]
\begin{equation*}
\expect*{\,\postsmash{\ubrace{\int_0^t v^2(s) \diff s}{\text{deterministic}}}\,}
\fixverticalspace
\end{equation*}
\lipsum[3][1-4]
\begin{equation*}
\expect[\bigg]{\,\int_0^t v^2(s) \diff s}
\end{equation*}
where the integral is deterministic.
\end{document}
Final recommendation: avoid \underbrace
as hard as possible.

\Biggl[ \Biggr]
?