LaTeX handles subscripts and superscripts nicely, automatically correcting for various sizing and placement issues. I am trying to build a function that works like subscripts and superscripts, but the smaller sized items are placed directly above/below/left/right of the main symbol, rather than upright/downright/upleft/downleft.
If such a command already exists, or you have suggestions for how to build one, I'd certainly appreciate a pointer or ideas.
In the meantime, I have tried many things (for instance \array gymnastics), all of which have problems. At present I am considering a TikZ-based method, as follows.
\newcommand{\putaround}[5]{
\begin{tikzpicture}[inner sep=0ex]
\node [label={[label distance=.1ex]below:$\scriptscriptstyle #2$},
label={[label distance=-.15ex]left:$\scriptscriptstyle #3$},
label={[label distance=.1ex]above:$\scriptscriptstyle #4$},
label={[label distance=-.15ex]right:$\scriptscriptstyle #5$}]
{$#1$}; %[minimum height=1ex,minimum width=1ex] {$\mathfrak A$};
\end{tikzpicture}
}
\[
\putaround{\mathrm H}{n}{m}{p}{q}
\]

The first of many issues with this is that the baselines of the left and right entries are off (a situation made especially vivid if you replace the m by an m'). I tried to adjust the label anchoring by adding anchor=mid various places to no avail.
My question then is, is there a way to anchor labels in a way that will correct this baseline/alignment issue?


\intfor one of the side labels to see what I mean. You might want to addtext height=0ptas well. – Andrew Stacey Feb 07 '13 at 15:21