# Graphics equations: put text on top of equations

How I can make sometimes the arrow direction up and sometimes down in a one unique tex file (I want to have both of them in a Latex-tex)? Following program make arrow down.

\documentclass{article}
\usepackage{graphicx}
\usepackage[usestackEOL]{stackengine}
\usepackage{xcolor}
\def\calloutsym{%
\ensurestackMath{%
\scalebox{1.7}{\color{red}\stackunder[0pt]{\bigcirc}{\downarrow}}}%
}
\newcommand\callouttext[1]{%
\def\stacktype{S}\renewcommand\useanchorwidth{T}\stackText%
\stackunder{\calloutsym}{\scriptsize\Longstack{#1}}\stackMath%
}
\newcommand\callout[3][1.5pt]{%
\def\stacktype{L}\stackMath\stackunder[#1]{#2}{\callouttext{#3}}%
}
\begin{document}
$K \callout{\subseteq}{by compactness} \bigcup_{J=1}^{n} V_{nJ}$
$\lim_{n\rightarrow \infty} \int\limits_{x} f_{n} \mathrm{d}\mu \callout[1.8pt]{=}{By Monotone\\Convergence Theorem} \int\limits_{x} f \mathrm{d}\mu$
\end{document}

• Change the \downarrow to an \uparrow on line 7. – Andrew Jul 7 '15 at 5:08

In addition to using \uparrow as suggested in a comment, two instances of \stackunder had to be changed to \stackon.

Of course, this question/answer are based on Graphics equations: put text on equations

\documentclass{article}
\usepackage{graphicx}
\usepackage[usestackEOL]{stackengine}
\usepackage{xcolor}
\def\calloutsym{%
\ensurestackMath{%
\scalebox{1.7}{\color{red}\stackon[0pt]{\bigcirc}{\uparrow}}}%
}
\newcommand\callouttext[1]{%
\def\stacktype{S}\renewcommand\useanchorwidth{T}\stackText%
\stackon{\calloutsym}{\scriptsize\Longstack{#1}}\stackMath%
}
\newcommand\callout[3][1.5pt]{%
\def\stacktype{L}\stackMath\stackunder[#1]{#2}{\callouttext{#3}}%
}
\begin{document}
$K \callout{\subseteq}{by compactness} \bigcup_{J=1}^{n} V_{nJ}$
$\lim_{n\rightarrow \infty} \int\limits_{x} f_{n} \mathrm{d}\mu \callout[1.8pt]{=}{By Monotone\\Convergence Theorem} \int\limits_{x} f \mathrm{d}\mu$
\end{document}


To handle both up and down callouts, just create tailored versions for each, invoked here with \upcallout[callout-vshift]{math item to callout}{callout text} and the corresponding \downcallout. REVISED to condense the code.

\documentclass{article}
\usepackage{graphicx}
\usepackage[usestackEOL]{stackengine}
\usepackage{xcolor}
\def\calloutsym{%
\ensurestackMath{%
\scalebox{1.7}{\color{red}\calloutstack[0pt]{\bigcirc}{\calloutarrow}}}%
}
\newcommand\callouttext[1]{%
\def\stacktype{S}\renewcommand\useanchorwidth{T}\stackText%
\calloutstack{\calloutsym}{\scriptsize\Longstack{#1}}\stackMath%
}
\newcommand\upcallout[3][1.5pt]{%
\def\calloutarrow{\uparrow}%
\def\calloutstack{\stackon}%
\def\stacktype{L}\ensurestackMath{\stackunder[#1]{#2}{\callouttext{#3}}}%
}
\newcommand\downcallout[3][1.5pt]{%
\def\calloutarrow{\downarrow}%
\def\calloutstack{\stackunder}%
\def\stacktype{L}\ensurestackMath{\stackunder[#1]{#2}{\callouttext{#3}}}%
}
\begin{document}
$K \upcallout{\subseteq}{by compactness} \bigcup_{J=1}^{n} V_{nJ}$
$\lim_{n\rightarrow \infty} \int\limits_{x} f_{n} \mathrm{d}\mu \downcallout[1.8pt]{=}{By Monotone\\Convergence Theorem} \int\limits_{x} f \mathrm{d}\mu$
\end{document}


• How I can make sometimes up and sometimes down in a one unique text file?? – user3271929 Jul 7 '15 at 11:54
• @user3271929 Please see revision. – Steven B. Segletes Jul 7 '15 at 12:15