I would like to loop over an array and access each x- and y-coordinate separately, because I want to modify the coordinates before using them on a node.
Currently it is only working when inserting the coordinates directly in the foreach loop, but my second example using an array is not working.
\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\def\myarr {
(1.0, 1.1),
(0.5, 1.5),
(1.5, 2)
}
\foreach \x/\y in {1/3, 2/7, 3/8} {
\node () at (\x,\y) {\x and \y};
}
% Not working
%\foreach \x/\y in {\myarr} {
% \node () at (\x,\y) {mynode};
%}
\end{tikzpicture}
\end{document}
How can I use an array to achieve the same result?
\def\myarr {1.0/1.1,0.5/1.5,1.5/2}
be acceptable?\documentclass{...
and ends with\end{document}
.