Is it possible to take a box and retrieve the following information from it:
- A list of all "top level" internal boxes;
- All intervening space (kerns and glue: did I forget another type of space?)?
You might wonder why I want this. The reason is that I would like to be able to write, in a natural manner, a piece of text, but then to place each character inside a TikZ node without changing the spacing. The reason for that is so that I can refer to individual terms in a formula (say, for the purpose of putting arrows between them).
Currently I achieve this by doing the following:
\documentclass{article}
\usepackage{tikz}
\usetikzpackage{chains}
\begin{document}
\tikzstyle{node text}=
[start chain,
every node/.append style = {
on chain, inner sep = 0pt, outer sep = 0pt,
execute at begin node = \strut},
node distance = 0pt]
\newcommand{\NodeTextCell}[2][]{
\node [inner sep = 0pt, outer sep = 0pt, #1] (my node)
\tikz[node text]{
\foreach \letter [count = \n] in {#2}
\node (my node*\n) {\letter};
}
}
\begin{tikzpicture}
\NodeTextCell{A, {}\otimes{}, B, {}\otimes{}, C}
\draw (my node*1.north) to[bend left=30] (my node*3.north);
\end{tikzpicture}
\end{document}
That's a little clunky, but I can live with it if necessary. If you can think of a better way to do just this with TikZ, that would also serve as an answer. Thanks!
\par. I don't think its techniques would help to break up a single line into characters. – Ryan Reich Nov 29 '10 at 22:47testagain. If this is what you are looking for I can post a macro for you. – yannisl Nov 29 '10 at 23:20