The LaTeX code below builds in Sublime Text 2 and gives the results:
7, -3.0, 4, -9.0, 11, -9.0, 1, two, 3.0, IV, cinq, sechs, 7.0,
But it gives the following errors when I remove the % character:
./example6.tex:12: Undefined control sequence. [\pgfmathparse{\myarray[3]}] ./example6.tex:13: Paragraph ended before \pgfmath@dimen@@ was complete. []
I'm using the latest version of tikz 3.0 and the 2013 version of MacTeX.
\documentclass[12pt]{memoir}
\usepackage{tikz}
\begin{document}
\def\myarray{{7,-3,4,-9,11}}
\foreach \i in {0,...,4}{\pgfmathparse{\myarray[\i]}\pgfmathresult, }
\pgfmathparse{\myarray[3]}\pgfmathresult,
\def\myarray{{1,"two",2+1,"IV","cinq","sechs",sin(\i*5)*14}}
\foreach \i in {0,...,6}{\pgfmathparse{\myarray[\i]}\pgfmathresult, }
%\pgfmathparse{\myarray[3]}\pgfmathresult,
\end{document}
\myarray[x]
you're trying to reference thex
-th entry in\myarray
? If so, TeX doesn't work that way...