Adding Comments to Equations

I was searching for quite a long time for a simple way of inserting short comments into latex equations. Recently I stumbled upon this solution by Steven B. Segletes that serves my needs. I have slightly modified the code to introduce arrows with both orientations and positioned above and under the equation.

The structure of the commands is:

\notateol[B<race>]{<referenced math>}{<dropline length in \baselineskips>}{<math notation>}

where ol stands for “over left”, ur for “under right” and so on. There might be more sophisticated alternatives around, but this one seems to me quite simple and straightforward. A MWE:

\documentclass{article}

\usepackage{stackengine}
\usepackage{scalerel}
\usepackage{graphicx,amsmath}
%\parskip \baselineskip
\def\myupbracefill#1{\rotatebox{90}{\stretchto{\{}{#1}}}
\def\rlwd{.5pt}
\def\myupbracefillon#1{\rotatebox{-90}{\stretchto{\{}{#1}}}
\def\rlwd{.5pt}

\newcommand{\texts}[1]{\text{\footnotesize{#1}}}

\newcommand\notateor[4][B]{%
  \if B#1\else\def\myupbracefillon##1{}\fi%
  \def\useanchorwidth{T}%
  \setbox0=\hbox{$\displaystyle#2$}%
  \def\stackalignment{c}\stackon[-6pt]{%
    \def\stackalignment{c}\stackon[-1.5pt]{%
      \stackon[2pt]{\strut $\displaystyle#2$}{\myupbracefillon{\wd0}}}{%
    \rule{\rlwd}{#3\baselineskip}}}{%
  \strut\kern9pt$\rightarrow$\smash{\rlap{$~\displaystyle#4$}}}%
}

\newcommand\notateol[4][B]{%
  \if B#1\else\def\myupbracefillon##1{}\fi%
  \def\useanchorwidth{T}%
  \setbox0=\hbox{$\displaystyle#2$}%
  \def\stackalignment{c}\stackon[-6pt]{%
    \def\stackalignment{c}\stackon[-1.5pt]{%
      \stackon[2pt]{\strut $\displaystyle#2$}{\myupbracefillon{\wd0}}}{%
    \rule{\rlwd}{#3\baselineskip}}}{%
  \smash{\llap{$~\displaystyle#4$}}$\leftarrow$\strut\kern9pt}%
}

\newcommand\notateur[4][B]{%
  \if B#1\else\def\myupbracefill##1{}\fi%
  \def\useanchorwidth{T}%
  \setbox0=\hbox{$\displaystyle#2$}%
  \def\stackalignment{c}\stackunder[-6pt]{%
    \def\stackalignment{c}\stackunder[-1.5pt]{%
      \stackunder[2pt]{\strut $\displaystyle#2$}{\myupbracefill{\wd0}}}{%
    \rule{\rlwd}{#3\baselineskip}}}{%
  \strut\kern9pt$\rightarrow$\smash{\rlap{$~\displaystyle#4$}}}%
}


\newcommand\notateul[4][B]{%
  \if B#1\else\def\myupbracefill##1{}\fi%
  \def\useanchorwidth{T}%
  \setbox0=\hbox{$\displaystyle#2$}%
  \def\stackalignment{c}\stackunder[-6pt]{%
    \def\stackalignment{c}\stackunder[-1.5pt]{%
      \stackunder[2pt]{\strut $\displaystyle#2$}{\myupbracefill{\wd0}}}{%
    \rule{\rlwd}{#3\baselineskip}}}{%
 \smash{\llap{$~\displaystyle#4$}}$\leftarrow$\strut\kern9pt}%
}

\begin{document}

\begin{equation}
\begin{aligned}\label{eq:lorentzforcelaw}
&\notateol[F]{{K}^{\tau}}{2}{{\texts{Lorentz force}}} = 
\notateul[F]{\mu}{1}{\texts{mass density}} \notateur[F]{\frac{du^\nu}{ds}}{2.5}{\texts{acceleration}}=\notateor[B]{-{f}_{\nu}^{\tau}}{2}{{\texts{$g^{\mu\nu}f_\nu^\tau=f_{\mu\nu}$}\;\; \texts{electromagnetic field strengths}}} {i}^{\nu} & \\
\notateol[F]{{i}^{\nu}}{2}{\texts{four-current}} = \notateul[F]{\rho}{2}{\texts{charge density}} \cdot {u}^{\nu} && \notateur[F]{{u}^{\nu}}{2}{\texts{four-velocity}} =\frac{{d}{x}^\nu}{{ds}}\,. 
\end{aligned}
\end{equation}

\end{document}