我怎样才能在一个唯一的 tex 文件中让箭头方向有时向上,有时向下(我想在 Latex-tex 中同时拥有它们)?以下程序使箭头向下。
\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
除了\uparrow
按照评论中的建议使用之外,还\stackunder
必须将两个实例更改为\stackon
。
当然,这个问题/答案是基于图形方程式:在方程式上添加文字
\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}
附录:
要处理向上和向下的标注,只需为每个标注创建定制版本,这里使用\upcallout[callout-vshift]{math item to callout}{callout text}
和相应的来调用\downcallout
。已修订以压缩代码。
\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}