I have a file called assocFile.dat
. The file has the following format:
0/b
1/d
2/f
3/h
I want to use this file to draw nodes (however it would be nice if this question can be answered in a general way, without having to worry about the number of values in a row).
\foreach\a/\b in {??} {
\draw (\a,0) node{\b};
}
is there a way to open the file and process tikz commands with the content of it?
EDIT: The .tex
file also writes to the file:
I've defined the following macro:
\newcommand{\writeToAssoc}[1]\newcommand{\writeToFile}{\immediate\write\assocfile{\arabic{assocCounter}/#1}\refstepcounter{assocCounter}}
after (!) writing the TikZ code I have the following sequence of commands:
\newwrite\assocfile
\immediate\openout\assocfile=assocFile.dat
\writeToAssoc{b}
\writeToAssoc{d}
\writeToAssoc{f}
\writeToAssoc{h}
\immediate\closeout\assocfile