The following code snippet is a part of the solution given here:
\def\IncludeOutput#1{
\parskip=2mm
\def\examplename{#1}
\pdfximage{\Directory/\examplename.pdf}%
\edef\lastpdfpage{\the\pdflastximagepages}
\repeat\for{pag}\by{0} % We advance manually the counter in the loop body
\until{\ifnum\pag>\lastpdfpage}
\do{
\noindent\hfill\fbox{%
\includegraphics[width=0.45\textwidth,page=\number\pag]{\Directory/\examplename.pdf}}%
\hfill%
\advance\pag by 1
\ifnum\pag>\lastpdfpage\hfill\par% If odd number of pages
\else% If even number of pages, output the last one
\fbox{%
\includegraphics[width=.45\textwidth,page=\number\pag]{\Directory/\examplename.pdf}}%
\hfill\hbox{}\par % Next pair of images
\fi%
\advance\pag by 1
}
}
I want to use \loop...\repeat
constructs in the code snippet above instead of the current looping constructs which are defined in \input{repeat}
.
I am not familiar with \loop...\repeat
, especially for nested loops and conditional statements such as checking whether the number is odd or even, checking whether a number is greater or equal to another number.
\IfFileExists
.\newif\ifFE \IfFileExists{myfile}{\FEtrue}{\FEfalse} \ifFE ... \else ... \fi