title: Iteration in LaTeX
body: <p>I would like to use some iteration control flow to simplify the following LaTeX code.</p>
  
  <pre><code>  \begin{sidewaystable}
    \caption{A glance of images}
    \centering
    \begin{tabular}{| c ||c| c| c |c| c|| c |c| c|c|c| }
    \hline
    \backslashbox{Theme}{Class} &amp;\multicolumn{5}{|c|}{Class 0} &amp; \multicolumn{5}{|c|}{Class 1}  \\
    \hline
  
    \hline
            1 &amp;
            \includegraphics[scale=2]{../../results/1/0_1.eps}
            &amp;\includegraphics[scale=2]{../../results/1/0_2.eps}
            &amp;\includegraphics[scale=2]{../../results/1/0_3.eps}
            &amp;\includegraphics[scale=2]{../../results/1/0_4.eps}
            &amp;\includegraphics[scale=2]{../../results/1/0_5.eps}
            &amp;\includegraphics[scale=2]{../../results/1/1_1.eps}
            &amp;\includegraphics[scale=2]{../../results/1/1_2.eps}
            &amp;\includegraphics[scale=2]{../../results/1/1_3.eps}
            &amp;\includegraphics[scale=2]{../../results/1/1_4.eps}
            &amp;\includegraphics[scale=2]{../../results/1/1_5.eps}      \\
    \hline
  
    ...  % similarly for 2, 3, ..., 22
  
    \hline
            23 &amp;
            \includegraphics[scale=2]{../../results/23/0_1.eps}
            &amp;\includegraphics[scale=2]{../../results/23/0_2.eps}
            &amp;\includegraphics[scale=2]{../../results/23/0_3.eps}
            &amp;\includegraphics[scale=2]{../../results/23/0_4.eps}
            &amp;\includegraphics[scale=2]{../../results/23/0_5.eps}
            &amp;\includegraphics[scale=2]{../../results/23/1_1.eps}
            &amp;\includegraphics[scale=2]{../../results/23/1_2.eps}
            &amp;\includegraphics[scale=2]{../../results/23/1_3.eps}
            &amp;\includegraphics[scale=2]{../../results/23/1_4.eps}
            &amp;\includegraphics[scale=2]{../../results/23/1_5.eps}      \\
    \hline
  
    \end{tabular}
    \end{sidewaystable}
  </code></pre>
  
  <p>I learn that the <a href="http://www.ctan.org/tex-archive/macros/latex/contrib/forloop/" rel="noreferrer">forloop package</a> provides the <code>for</code> loop. But I am not sure how to apply it to my case? Or other methods not by forloop?</p>
  
  <hr>
  
  <p>If I also want to simply another similar case, where the only difference is that the directory does not run from 1, 2, to 23, but in some arbitrary order such as 3, 2, 6, 9,..., or even a list of strings such as dira, dirc, dird, dirb,.... How do I make the LaTeX code into loops then?</p>