iteration in latex
Posted
by Tim
on Stack Overflow
See other posts from Stack Overflow
or by Tim
Published on 2010-04-01T16:03:05Z
Indexed on
2010/04/01
16:23 UTC
Read the original article
Hit count: 712
Hi,
I would like to use some iteration control flow to simplify the following latex 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} &\multicolumn{5}{|c|}{Class 0} & \multicolumn{5}{|c|}{Class 1} \\
\hline
\hline
1 &
\includegraphics[scale=2]{../../results/1/0_1.eps}
&\includegraphics[scale=2]{../../results/1/0_2.eps}
&\includegraphics[scale=2]{../../results/1/0_3.eps}
&\includegraphics[scale=2]{../../results/1/0_4.eps}
&\includegraphics[scale=2]{../../results/1/0_5.eps}
&\includegraphics[scale=2]{../../results/1/1_1.eps}
&\includegraphics[scale=2]{../../results/1/1_2.eps}
&\includegraphics[scale=2]{../../results/1/1_3.eps}
&\includegraphics[scale=2]{../../results/1/1_4.eps}
&\includegraphics[scale=2]{../../results/1/1_5.eps} \\
\hline
\hline
2 &
\includegraphics[scale=2]{../../results/2/0_1.eps}
&\includegraphics[scale=2]{../../results/2/0_2.eps}
&\includegraphics[scale=2]{../../results/2/0_3.eps}
&\includegraphics[scale=2]{../../results/2/0_4.eps}
&\includegraphics[scale=2]{../../results/2/0_5.eps}
&\includegraphics[scale=2]{../../results/2/1_1.eps}
&\includegraphics[scale=2]{../../results/2/1_2.eps}
&\includegraphics[scale=2]{../../results/2/1_3.eps}
&\includegraphics[scale=2]{../../results/2/1_4.eps}
&\includegraphics[scale=2]{../../results/2/1_5.eps} \\
\hline
... % similarly for 3, 4, ..., 22
\hline
23 &
\includegraphics[scale=2]{../../results/23/0_1.eps}
&\includegraphics[scale=2]{../../results/23/0_2.eps}
&\includegraphics[scale=2]{../../results/23/0_3.eps}
&\includegraphics[scale=2]{../../results/23/0_4.eps}
&\includegraphics[scale=2]{../../results/23/0_5.eps}
&\includegraphics[scale=2]{../../results/23/1_1.eps}
&\includegraphics[scale=2]{../../results/23/1_2.eps}
&\includegraphics[scale=2]{../../results/23/1_3.eps}
&\includegraphics[scale=2]{../../results/23/1_4.eps}
&\includegraphics[scale=2]{../../results/23/1_5.eps} \\
\hline
\end{tabular}
\end{sidewaystable}
I learn that the forloop package provides the for loop. But I am not sure how to apply it to my case? Or other methods not by forloop?
Thanks and regards!
Update:
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 to make the latex code into loops then?
Thanks!
© Stack Overflow or respective owner