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


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

  • Can be much easier if you choose a certain color instead.
    – AboAmmar
    May 22, 2021 at 10:02

2 Answers 2


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.



 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}


enter image description here


You can do that with tikz:

\usepackage    {tikz}
\usetikzlibrary{babel} % for issues with some babel packages

\[ 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);

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.