# foreach loop in tikz and math mode

Here is what I want to do:

\begin{tikzpicture}

\foreach \i in {1,...,8}
\foreach \j in {1,...,8}
\foreach \t in {1,2,3}{
\node () at (\i,\t,\j) {$X_{\i,\j,\t}$};
}

\end{tikzpicture}


I want to create a set of nodes in 3D, with certain math labels. Unfortunately, Tikz does not allow me to do a naive thing like this, any help is appreciated!

Update Okay-- This is a dumb question. It seems like Tikz is interfered by some other packages and making errors, I removed a bunch of packages and it works...

• \documentclass[border=3.14mm,tikz]{standalone} \begin{document} \begin{tikzpicture} \foreach \i in {1,...,8} \foreach \j in {1,...,8} \foreach \t in {1,2,3}{ \node () at (\i,\t,\j) {$X_{\i,\j,\t}$}; } \end{tikzpicture} \end{document} works. What problems do you encounter? – user121799 Aug 7 at 18:46

You need to make a minimal compilable example, and you need to describe your problem. What do you mean by TikZ does not allow you to do it?

 \documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\foreach \i in {1,...,8}
\foreach \j in {1,...,8}
\foreach \t in {1,2,3}{
\node () at (\i,\t,\j) {$X_{\i,\j,\t}$};
}
\end{tikzpicture}
\end{document}


• I think the problem was caused by other packages, I removed a lot of packages and error disappeared. Thanks! – Wenze 'Sylvester' Zhang Aug 7 at 18:59