I have a series of complicated content I'm trying to present using TikZ. The code is highly regular, so I wanted to write a simple command to handle everything. In the following code, \aelabelA and \aelabelC are not working properly at all and I don't understand why. However, \aelabelB does work. Could someone explain why the content of the boxes for scenario A and C is not visible?
\documentclass{standalone}
\usepackage{xparse}
\usepackage{tikz}
\ExplSyntaxOn
\newsavebox\aebox
\NewDocumentCommand\aelabelA{ mu{~located~at~(}u{);} }
{
\begin{lrbox}{\aebox}
\begin{minipage}{1in}
\Large\ttfamily\bfseries
\centering\makebox[0pt]{#1}
\end{minipage}
\end{lrbox}
\node[draw] ~ at~ (#3) ~ {\usebox{\aebox}};
}
\NewDocumentCommand\aelabelB{ m }
{
\begin{lrbox}{\aebox}
\begin{minipage}{1in}
\Large\ttfamily\bfseries
\centering\makebox[0pt]{#1}
\end{minipage}
\end{lrbox}
\usebox{\aebox}
}
\ExplSyntaxOff
\def\aelabelC#1 located at (#2);{%%
\begin{lrbox}{\aebox}
\begin{minipage}{1in}
\Large\ttfamily\bfseries
\centering\makebox[0pt]{#1}
\end{minipage}
\end{lrbox}%%
\node[draw] at (#2) {\usebox{\aebox}};
}
\begin{document}
\begin{tikzpicture}
\coordinate (AA) at (0,0);
\coordinate (BB) at (2,2);
\coordinate (CC) at (4,4);
\aelabelA {Keys} located at (AA);
\node[draw] at (BB) {\aelabelB{Keys}};
\aelabelC{Keys} located at (CC);
\end{tikzpicture}
\end{document}


lrboxes? As you see in your example B, if you do thelrboxinside a node, it won't be gobbled. If you could explain what you really want to do, perhaps there is a way with the usual TikZ/pgf methods. – Aug 30 '18 at 21:24