I'd like to avoid having to copy & paste the same code 50 times in my input file, so I'm trying to use the automation offered by TikZ's \foreach.

I do not know why this code generates 101 errors. The first one is that an extra } was used.

\matrix[row sep=1mm,column sep=5mm] {
\foreach \y in {1,...,50} {
\node (left) {\includegraphics[width=0.49\textwidth {images/S001_GUT1_COR_T2/Original/15}}; &
\node [right=of left] {\includegraphics[width=0.49\textwidth {images/S001_GUT1_COR_T2/Segmented/15}}; \\ 

Can you help me?

I have found and alternative to my question. But know I have another problem: how can I split the contents of one tikzpicture in more than one page?

\node (row1) {\includegraphics[width=0.49\textwidth]{images/Original/1}};
\node[left=0mm of row1]  {\includegraphics[width=0.49\textwidth]{images/Segmented/1}};
\foreach \i [remember=\i as \lastx (initially 1)] in {2,...,10} {
\node[below=0mm of row\lastx] (row\i) {\includegraphics[width=0.49\textwidth]{images/Original/\i}};
\node[left= 0mm of row\i]  {\includegraphics[width=0.49\textwidth]{images/Segmented/\i}};

Just use a center environment. There's no need to do complicated positioning for images that all have the same dimensions.

\usepackage{pgffor} % \foreach

\foreach \i in {1,2,...,10} {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.