Equation with vertical arrow
The command \uparrow
makes an extensible arrow.
\documentclass{article}
\usepackage{mathtools}
\newcommand\vertarrowbox[3][6ex]{%
\begin{array}[t]{@{}c@{}} #2 \\
\left\uparrow\vcenter{\hrule height #1}\right.\kern-\nulldelimiterspace\\
\makebox[0pt]{\scriptsize#3}
\end{array}%
}
\begin{document}
\begin{equation*}
0 \leq F =
{\underbrace{\sum_{i=1}^{n}(y_i-\bar{y})^2}_{(n-1)s_y^2}}
-\vertarrowbox{2b}{text}
{\underbrace{{}\sum_{i=1}^{n}(x_i-\bar{x})(y_i-\bar{y})}_{(n-1)s_{xy} = (n-1)rs_xs_y}}
+\vertarrowbox{b^2}{More text}
{\underbrace{{}\sum_{i=1}^{n}(x_i-\bar{x})^2}_{(n-1)s_x^2}}
\end{equation*}
\begin{equation*}
0 \leq F =
\sum_{i=1}^{n}(y_i-\bar{y})^2
-2b
\sum_{i=1}^{n}(x_i-\bar{x})(y_i-\bar{y})
+b^2
\sum_{i=1}^{n}(x_i-\bar{x})^2
\end{equation*}
\end{document}
The strange braces can be easily explained: \underbrace
makes an Op atom, which conflicts with the spacing of binary operations, so it's best to brace it. However, if \sum
is preceded by an ordinary symbol, a thin space should appear, which is produced by the empty subformula {}
inside \underbrace
when necessary.
The second display shows the standard spacing without \underbrace
and the arrows, just for checking the spaces are the same.
The \vertarrowbox
has an optional argument for the desired height of the arrow, default 6ex. Call it as \vertarrowbox[12ex]{<symbol>}{<text>}
if you want to double the height (its size should depend on context).
Something like this? Observe that the solution sets a macro called \vertarrowbox
, which takes two arguments: (a) the stuff to be placed on the main line of the equation, and (b) the text to be placed below the long vertical arrow.
\documentclass{article}
\usepackage{mathtools,graphicx}
\newcommand\vertarrowbox[2]{%
\begin{array}[t]{@{}c@{}} #1 \\
\rotatebox{90}{$\xrightarrow{\hphantom{abcdefgh}}$} \\[-1ex]
\mathclap{\scriptstyle\text{#2}}%
\end{array}}
\begin{document}
\begin{equation*}
0 \leq F =
\underbrace{\sum_{i=1}^{n}(y_i-\bar{y})^2}%
_{(n-1)s_y^2}
{}-{}\vertarrowbox{2b}{text}
\underbrace{\sum_{i=1}^{n}(x_i-\bar{x})(y_i-\bar{y})}%
_{(n-1)s_{xy} = (n-1)rs_xs_y}
{}+{}\vertarrowbox{b^2}{More text}
\underbrace{\sum_{i=1}^{n}(x_i-\bar{x})^2}%
_{(n-1)s_x^2}
\end{equation*}
\end{document}
one possibilities is use of the package tikz
and its tikzmark
library:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usepackage{lipsum}% for dummy text
\begin{document}
\lipsum*[11]
\[
0 \leq F = \underbrace{\sum_{i=1}^{n}(y_i - \overline{y})^2}_{(n-1)s_y^2}
- \tikzmark{A}2b
\underbrace{\sum_{i=1}^{n}(x_i - \overline{x})(y_i - \overline{y})}_{(n-1)s_{xy} = (n-1)rs_xs_y}
+ \tikzmark{B}b^2
\underbrace{\sum_{i=1}^{n}(x_i - \overline{x})^2}_{(n-1)s_x^2}
\begin{tikzpicture}[overlay, remember picture,shorten <=1mm,font=\footnotesize]
\draw[<-] ([xshift=1.0ex] pic cs:A) -- ++ (0,-1.2) node[below] {text};
\draw[<-] ([xshift=0.5ex] pic cs:B) -- ++ (0,-1.2) node[below] {text};
\end{tikzpicture}
\bigskip
\]
\lipsum*[12]
\end{document}