2

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}
  • 1
    Change the \downarrow to an \uparrow on line 7. – Andrew Jul 7 '15 at 5:08
4

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}

enter image description here

ADDENDUM:

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}

enter image description here

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.