Thanks in advance...
\documentclass[11pt,letterpaper]{article}
\usepackage{amsmath}
\begin{document}
with `brute-force' horizontal spacing
\begin{align*}
\hat{S}_i &= \mu + \left(S_i-\mu\right) + \left(\hat{S}_i-S_i\right)\\
&=\mu+ \underbrace{\quad\;\delta_i\quad\;\,}_{\begin{smallmatrix}
\uparrow\;\sigma^2 \\
~\\
\text{\scriptsize{(process}}\\ \text{\scriptsize{variance)}}
\end{smallmatrix}} +
\,\underbrace{\quad\;\epsilon_i\quad\;\,}_{\begin{smallmatrix}
\uparrow\;\mbox{\scriptsize{var}}\left(\hat{S}_i|S_i\right) \\
~\\
\text{\scriptsize{(sampling}}\\ \text{\scriptsize{variance)}}
\end{smallmatrix}}
\end{align*}
without horizontal spacing
\begin{align*}
\hat{S}_i &= \mu + \left(S_i-\mu\right) + \left(\hat{S}_i-S_i\right)\\
&=\mu+ \underbrace{\delta_i}_{\begin{smallmatrix} \uparrow\;\sigma^2 \\
~\\
\text{\scriptsize{(process}}\\ \text{\scriptsize{variance)}}
\end{smallmatrix}} + \underbrace{\epsilon_i}_{\begin{smallmatrix}
\uparrow\;\mbox{\scriptsize{var}}\left(\hat{S}_i|S_i\right) \\
~\\
\text{\scriptsize{(sampling}}\\ \text{\scriptsize{variance)}}
\end{smallmatrix}}
\end{align*}
\end{document}
\usepackage{calc}
\newcommand{\centerto}[2]{%
\makebox[\widthof{$\displaystyle#2$}]{$\displaystyle#1$}}
...
\begin{align*}
\hat{S}_i &= \mu + (S_i-\mu) + (\hat{S}_i-S_i)\\
&=\mu +
\underbrace{\centerto{\delta_i}{(S_i-\mu)}}
_{\begin{subarray}{c}
\uparrow\;\sigma^2\\
\text{(process}\\
\text{variance)}
\end{subarray}}
+
\underbrace{\centerto{\epsilon_i}{(\hat{S}_i-S_i)}}
_{\begin{subarray}{c}
\uparrow\;\operatorname{var}(\hat{S}_i\mid S_i)\\
\text{(sampling}\\
\text{variance)}\\
\end{subarray}}
\end{align*}
Ciao
Enrico
You can also consider using \substrack, with \\[dimen] for spacing:
\begin{align*}
\hat S_i &= \mu + \left(S_i-\mu\right) + \left(\hat S_i-S_i\right)\\
&= \mu + \underbrace{\quad\;\delta_i\quad\;\,}_{\substack
{\uparrow\;\sigma2 \\[1ex]
\text{(process}\\ \text{variance)}}}
+
\,\underbrace{\quad\;\epsilon_i\quad\;\,}_{\substack{\uparrow\;\operatorname{var}\left(\hat
S_i\middle| S_i\right) \\
\text{{(sampling}}\\ \text{{variance)}}}}
\end{align*}
Very slick -- works very well. Thank you very much!
Hmm -- looks intriguing, but I can't get it to compile.
I let TeX do the measurements; with \centerto I tell it
to place the first argument in a space as wide as the
second.
For multiple line subscripts, there's "subarray", to
which you can tell the alignment.
Ciao
Enrico
>> Very slick -- works very well. Thank you very much!
>
> I let TeX do the measurements; with \centerto I tell it
> to place the first argument in a space as wide as the
> second.
>
> For multiple line subscripts, there's "subarray", to
> which you can tell the alignment.
>
> Ciao
> Enrico
Presumably you can achieve much the same thing with \hphantom.
\documentclass [a4paper]{article}
\usepackage {amsmath}
\begin{document}
\begin{align*}
\hat S_i &= \mu + \left(S_i-\mu\right) + \left(\hat S_i-S_i\right)\\
&= \mu + \underbrace{\quad\;\delta_i\quad\;\,}
_{\substack {\uparrow\;\sigma2 \\[1ex]
\text{(process}\\ \text{variance)}}}
+ \,\underbrace{\quad\;\epsilon_i\quad\;\,}
_{\substack{\uparrow\;\operatorname{var}
\left(\hat S_i\middle| S_i\right) \\
\text{{(sampling}}\\ \text{{variance)}}}}
\end{align*}
\end{document}\endinput
> Hmm -- looks intriguing, but I can't get it to compile.
This is because those crap environment from the AmS don't allow
a blank line in their body...
Regards.
The problem is not only to leave a space, but to place an
object in the middle of it. There are other solutions, of course,
for example
\newcommand{\centerto}[2]{%
{\ooalign{$\displaystyle\hphantom{#2}$\cr
\hidewidth$\displaystyle#1$\hidewidth\cr}}}
which does not require calc, but requires to know \ooalign.
In any case TeX has to typeset #2 in order to measure its
width.
Ciao
Enrico
Yes and what if you want to extend the mechanism to typeset :
A = ÔøΩ + .... + ..... \\
= ÔøΩ + ..... + ..... \\
= ÔøΩ + ...... + ...... \\
= ÔøΩ + ... + ... \\
|------| |------|
Is there something to align the operands ? {array} ?
Regards.
alignat, though it may cost a few extra &'s and perhaps a few {}'s
I'd set an \halign with a dummy last row; then I'd get at
\lastbox, dismantle it and use the measures for setting
the lengths of the braces.
Too complicated: some visual formatting is sometimes the
fastest way. Such constructions are not so frequent as
to require a general solution.
Ciao
Enrico
Alignment requires & obviously... Then AmS can give the columns widths:
\documentclass [a4paper]{article}
\usepackage {amsmath}
\begin{document}\makeatletter
\def\AmScolumnwidth #1{\ifmeasuring@ #1\else
\hbox to\AmScolumn@width {\hss$#1$\hss}\fi }
\def\AmScolumn@width {\ifcase \numexpr\column@+1\maxcolumn@widths \fi }
\begin{alignat*}{6}
\hat S_i &= \mu &+ &\left(S_i-\mu\right) &+& \left(\hat S_i-S_i\right)\\
&= \mu &+ &\underbrace{\AmScolumnwidth{\delta_i}}
_{\substack {\uparrow\;\sigma2 \\[1ex]
\text{(process}\\ \the\column@
\text{variance)}}}
&+ &\underbrace{\AmScolumnwidth{\epsilon_i}}
_{\substack{\uparrow\;\operatorname{var}
\left(\hat S_i\middle| S_i\right) \\
\text{{(sampling}}\\
\text{{variance)}}}}
\end{alignat*}
\end{document}\endinput
\substack for concision but subarray would go as well.
Cheers.
Not too complicated if one know how AmS stores its dimensions.
But too late, i've posted the solution already... might be of interest
for something else yet.
>
> Ciao
> Enrico