I have made two new commands for making what the first one (\mathnote) does, but with some changes.
The new command (\mathnotee) is what I want, but is not working and I don't know why, I wante that my command (\mathnotee) could work in math mode and you could select where the arrow is pointing and what note appears with out defining what is before and what is after (as \mathnote does), because if I want to doit several times in one equation it makes it really hard. Thank you for your help.
\documentclass{book}
\usepackage{amsmath,amssymb}
\usepackage{nccmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usepackage{tcolorbox}
\tcbuselibrary{most}
\newtcolorbox[auto counter,
number within=chapter,
list inside=myexercise
]{myexercise}[1][]{%
enhanced,
title={{\begin{minipage}{\linewidth}\textbf{Ejercicio}~\thetcbcounter.~\textit{#1}\end{minipage}}},
halign title=left,
sharp corners,
colback=white,
coltitle=black,
colbacktitle=white,
boxrule=0pt,frame hidden,
overlay unbroken={\draw[black,double] (interior.north west)--(segmentation.west);},
boxed title style={%
colframe=white,
boxrule=0pt,
colback=white,
left=0pt,
right=0pt},
attach boxed title to top left={xshift={-5pt}},
underlay unbroken={\draw[help lines,step=3.8mm,black!20!white](interior.south west) grid (segmentation.east);},
lower separated=false,
before lower = {\tcbsubtitle[colback=white, opacityback=0, colframe=black, opacityframe=0, boxrule=1pt, height=1cm, width=2.55cm, valign=center]{\textbf{Solution:}}}
}
\newcommand{\mathnotee}[2]{
;
\tikzmarknode{e1}{#1}
;
\begin{tikzpicture}[overlay,remember picture]
\draw[stealth-,black,thick] (e1)+(90:.2)--+(90:.7) node[above=-2mm]{#2};
\end{tikzpicture}
}
\newcommand\mathnote[4]{
[#1;
\tikzmarknode{e1}{#2}
;#3
]
\begin{tikzpicture}[overlay,remember picture]
\draw[stealth-,black,thick] (e1)+(90:.2)--+(90:.7) node[above=-2mm]{#4};
\end{tikzpicture}
}
\usepackage{witharrows}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\mathnote{A(r)=\displaystyle\int_{V'}\dfrac{\mu_0}{4\pi}\dfrac{M(r')\times \hat{R} d\tau'}{R^2}}{=}{\dfrac{\mu_0}{4\pi}\int_{V'}M(r')\times\nabla'\left(\dfrac{1}{R}\right)d\tau'}{$\dfrac{\hat R}{R^2}=\nabla'\left(\dfrac{1}{R}\right)$}
$A(r)=\displaystyle\int_{V'}\dfrac{\mu_0}{4\pi}\dfrac{M(r')\times \hat{R} d\tau'}{R^2}\mathnotee{=}{\dfrac{\hat R}{R^2}=\nabla'\left(\dfrac{1}{R}\right)}\dfrac{\mu_0}{4\pi}\int_{V'}M(r')\times\nabla'\left(\dfrac{1}{R}\right)d\tau'$
\end{document}
The firs equation is what \mathnote does (but you need to be outside math mode, and define what is before and after the arrow), and the second one is what \mathnotee does (which isn't working).
Also here is what I mean when using it more than once in an equation:
This question is based in the previous question I made: Math notes between equations


\downarrowsymbol is an extensible delimiter. – SebGlav Jan 03 '22 at 22:13