How can I attach an arrow with text to some part of an equation?
Asked
Active
Viewed 1,272 times
2 Answers
10
Here's something to get you started using Andrew Stacey's \tikzmark idea, first posted here
Adding a large brace next to a body of text

MWE
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1){};}
\begin{document}
\[
\int\limits_{\tikzmark{Vi}V_i}f(r)\mathrm{d}r
\tikz[overlay, remember picture] \node[below right=1cm of Vi](annotate){Your text here};
\tikz[overlay,remember picture]\path[red,->] ($(Vi.south)+(.2em,0em)$) edge[bend right=45](annotate.west);
\]
\end{document}
The idea is to add nodes to your expression, and then connect them as you see fit. The main tool is overlay, remember picture from tikz.
And if you want the right angled line

then you can use something like
\tikz[overlay,remember picture]\draw[red,->] ($(Vi.south)+(.2em,0em)$) -- ++(0,-.95cm)--(annotate.west);
-
You may have to add extra vspace after the diagram as this does not create extra space to allocate the labelling. It runs on top of the text that follows. – azetina Nov 12 '12 at 20:02
7
This had to be fine tuned but it is completely general and requires no tikz. It's in plain TeX, but it should work with LaTeX after minor edits.
The idea is to manually position boxes to form an arrow with the specified shape (\cornerarr). Then one uses the equation alignment environment to place this arrow below the desired point.
The MWE:
\def\cornerarr{\hbox to 1.7cm{$\uparrow$\hskip-2.5pt\hbox{\lower2pt\vbox{\hbox to 1.5cm{\hrulefill}}}}}
$$\eqalignno{
= {1\over v(r)} \sum_{i}^{N(v(r))} m_i &\int_{v_i} d^3r f_i(r)\cr
&\hskip3pt\cornerarr\hbox{\lower2pt\vbox{\hbox{Volumen des i-ten Teilchens}}}
}$$
\bye

Update: MWE in LaTeX:
\documentclass{article}
\usepackage{amsmath}
\def\cornerarr{\hbox to 1.7cm{$\uparrow$\hskip-2.5pt\hbox{\lower2pt\vbox{\hbox to 1.5cm{\hrulefill}}}}}
\begin{document}
\begin{align*}
= {1\over v(r)} \sum_{i}^{N(v(r))} m_i &\int_{v_i} d^3r f_i(r) \\
&\hskip3pt\cornerarr\hbox{\lower2pt\vbox{\hbox{Volumen des i-ten Teilchens}}} \\
\end{align*}
\end{document}
David Carlisle
- 757,742
Mafra
- 1,615