# How to use tikzmark to label steps in math mode with fractions?

I have an equality between to fractions in math mode and want to be able to show how we got from one to another. I want to use arrows and label them. Ideally, it should look like this:

I have the feeling I should use tikzmark but I'm not quite sure how to make it work properly.

There is my mwe:

\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage{amsmath}
\begin{document}
$\dfrac{42}{72}=\dfrac{7}{12}$
\end{document}


Yes, you can use tikzmark as follows.

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}
$$\dfrac{\tikzmarknode{42}{42}} {\tikzmarknode{72}{72}}= \dfrac{\tikzmarknode{7}{7}} {\tikzmarknode{12}{12}}$$
\begin{tikzpicture}[overlay,remember picture]
\draw[-stealth,shorten >=1mm,shorten <=1mm] (42.north)--++(90:.5)-|(7.north) node[above,pos=.25,red,scale=.8]{$:6$};
\draw[-stealth,shorten >=1mm,shorten <=1mm] (72.south)--++(-90:.5)-|(12.south) node[below,pos=.25,red,scale=.8]{$:6$};
\end{tikzpicture}
\end{document}


Explanation for pos=.25: we see how operation ++ affect to the option pos.

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}
$$\dfrac{\tikzmarknode{42}{42}} {\tikzmarknode{72}{72}}= \dfrac{\tikzmarknode{7}{7}} {\tikzmarknode{12}{12}}$$
\begin{tikzpicture}[overlay,remember picture]
\draw[-stealth,shorten >=1mm,shorten <=1mm] (42.north)--++(90:.5)-|(7.north) node[pos=0,red,scale=.5]{x} node[pos=0,blue,scale=.4,above]{pos=0}
node[pos=.25,red,scale=.5]{x} node[pos=.25,blue,scale=.4,below]{pos=0.25}
node[pos=.5,red,scale=.5]{x} node[pos=.5,blue,scale=.4,above]{pos=0.5}
node[pos=1,red,scale=.5]{x} node[pos=1,blue,scale=.4,right=3mm]{pos=1}
;
\draw[-stealth,shorten >=1mm,shorten <=1mm] (72.south)--++(-90:.5)-|(12.south) node[below,pos=.25,red,scale=.8]{$:6$};
\end{tikzpicture}
\end{document}