What way do you recommend to access the
- the label text
of a named node later in the same tikzpicture?
Small example:
\begin{tikzpicture}
\node (curve0) at (0,0) [] {curve $C_0$};
\node (alaternodeinwhichlabeltextofcurveoughttobeused) at (0,2) { The following is a label text of a node we already defined: (curve0.label text) };
\end{tikzpicture}
where, of course, the above use of "(curve0.label text)" is not permissible, but in analogy to existing features like "(curve0.center)".
This must be very usual, but is escaping my reading of the literature.
Feel free to correct if "label text" is not the correct technical term for this particular entity (I am taking it from a certain error message produced by tikz).
Edit: Like recommended in the comments, a workaround is to use a separate macro. For example:
\begin{tikzpicture}
\newcommand{\labeltextofcurve0}{curve $C_0$};
\node (curve0) at (0,0) [] {\labeltextofcurve0};
\node (alaternodeinwhichlabeltextofcurve0oughttobeused) at (0,2) { An isotopy from \labeltextofcurve0 to the curve $C_\infty$ is the following: ... };
\end{tikzpicture}
However, there are at least two issues with this:
Quantitative: this solution requires one separate line of code for each label text. (In the problem motivating this question, there are many nodes, each of whose label text I would like to access. Imagine (curve0), (curve1), ... , (curve 17), and having one separate \newcommand{\labeltextof...} for each...) It appears more natural to define the label text in the content of the node.
Qualitative: there is a decision to be made where to place the \newcommmand{\labeltextofcurve0}. Sure, immediately before the definition of (curve0) seems a canonical choice, but there are issues with 'scopes', that appear too complicated and cofusing to describe here.
Therefore, wouldn't it be better to have a way to say (curve0.label text), and have it work whenever (curve0) is defined somewhere else in the code?
An opinion on whether using the additional
\newcommand{\labeltextofcurve0}{curve $C_0$};
is to be preferred over trying to get a "(curve0.label text)"-feature would be appreciated.


\label/\refpair? If so, what should the\refreturn? Or do you mean to have a way to save the text of a label in a macro that can be called elsewhere? – Steven B. Segletes May 16 '17 at 11:01{label $x$}in this case (why the extra braces, by the way?) – Torbjørn T. May 16 '17 at 11:05\newcommand\textofmyfirstnode{label $x$}, and use\textofmyfirstnodein both nodes. Somewhat related question: https://tex.stackexchange.com/questions/332215 Note the first sentence of the answer. – Torbjørn T. May 16 '17 at 11:19@<username>to ping a user, see https://meta.stackexchange.com/questions/43019 You are always notified, because it's your post.) – Torbjørn T. May 16 '17 at 12:10label=below:label of nodein the options. Forest can do this, but that isn't much help unless you are drawing a tree. – cfr May 16 '17 at 12:15\refstepcounterfor example)? – Paul Gaborit May 23 '17 at 05:00