tikzmark subnode in math changes font size

The latest version of tikzmark is now available on ctan and is now in TeXLive. This has the new math-aware version of \subnode in it which will match the surrounding math mode for its contents. Your original code will work except that you shift into math mode inside the \subnode which you shouldn't do as \subnode now takes care of that itself.

\documentclass{standalone}
%\url{https://tex.stackexchange.com/q/459497/86}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}

\begin{tikzpicture}[remember picture]
\node[align=left] {\(A_A\) (no subnode) \\
                   \(\subnode{n1}{A}_{\subnode{n2}{A}}\) (with subnode)};
\draw[<-] (n2) -- ++(0,-5mm);
\end{tikzpicture}

\end{document}

all new math-aware subnode


Disclaimer: I have not much experience with subnode. Nor do I know if the following proposal is absolutely safe. I really hope @LoopSpace will tell us what one is really supposed to do here. I guess you want to read this answer carefully.

Meanwhile, this is just to report that the rather new addition to the already very nice tikzmark library \tikzmarknode makes this amazing library even more powerful. And at least in this case it seems to work.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}

\begin{tikzpicture}[remember picture]
\node[align=left] {$A_A$ (no subnode) \\
                   $\tikzmarknode{n1}{A}_{\tikzmarknode{n2}{A}}$ (with tikzmarknode)};
\draw[<-] (n2) -- ++(0,-5mm);
\end{tikzpicture}

\end{document}

enter image description here