0

Is it possible to draw annotations inside math formulas ? I want to see if it helps for pedagogical purposes.

For example I would like to draw the arrow in red between the two symbols in the following formula, to highlight the fact that they are the same:

enter image description here

\documentclass[10pt,landscape,a4paper]{article}    
\begin{document}

$$ P ( \xi \in B )  = \int_B f_{\xi} dx $$

\end{document}
1
  • Can be much easier if you choose a certain color instead.
    – AboAmmar
    May 22, 2021 at 10:02

2 Answers 2

3

Quite easy with pst-node: define both B's as rnodes and connect them by one of the node connections.

Unrelated: don't use $$ … $$ in LaTeX, this is a plain TeX syntax, and you'll have bad vertical spacing. Use \[ … \] instead.

\documentclass[10pt,landscape,a4paper]{article}
\usepackage{pst-node}

\begin{document}

\[
 P ( \xi \in \rnode{B1}{B} ) = \int_{\rnode{B2}{B}} f_{\xi} dx
 \psset{arrowinset=0.1, linejoin=1}
 \ncbar[linecolor=red, angle=-90, nodesep=2pt]{<->}{B1}{B2}
\]

\end{document} 

enter image description here

4

You can do that with tikz:

\documentclass[10pt,landscape,a4paper]{article}
\usepackage    {tikz}
\usetikzlibrary{babel} % for issues with some babel packages
\usetikzlibrary{tikzmark}

\begin{document}
\[ P ( \xi \in \tikzmarknode{B1}B ) = \int_{\tikzmarknode{B2}B} f_{\xi}\,dx \]
\begin{tikzpicture}[overlay,remember picture]
\draw[<->,red,out=-100,in=-100] ([yshift=-2pt]B1.south) to ([yshift=-2pt]B2.south);
\end{tikzpicture}
\end{document}

enter image description here

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.