Please consider this MWE:
\documentclass[a4paper, landscape]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[most]{tcolorbox}
\newcommand\UseImage[1]{%
\IfFileExists{#1.jpg}%
{\includegraphics[scale=\ImageScale]{#1.jpg}}%
{\includegraphics[scale=\ImageScale]{example-image.jpg}}%
}
% =======================================
% Input ===================================
\def\BottomTitle{Bottom Title}
\def\ImageScale{0.5}
\def\ImageLeft{\UseImage{SomeImageName-1}}
\def\ImageRight{\UseImage{SomeImageName-17}}
%
\newcommand{\PictureIndexStartsAt}{1}
\newcommand{\PictureIndexEndsAt}{16}
% =======================================
% =======================================
\begin{document}
% Page Box:
\begin{tcolorbox}[]
% Images:
\begin{tcbitemize}[raster columns=2, raster force size=false]
\tcbitem[remember as=LeftRasterbox, width=9cm] \ImageLeft
\tcbitem[remember as=RightRasterbox, width=9cm] \ImageRight
\end{tcbitemize} % remeber as=<name> for later TikZ-usage
%
\tcblower
\BottomTitle
\end{tcolorbox}
\begin{tikzpicture}
% ................ Here is more code that should be on every page, at the same spot
\end{tikzpicture}
\end{document}
You can see, that, if the files exist, the left image should print SomeImageName-1.jpg
and the right image should print SomeImageName-17.jpg
on page 1.
In other words, we currently have:
SomeImageName-1.jpg
(page 1, left)SomeImageName-17.jpg
(page 1, right)
There is also some more tikzpicture
code which needs to be print on every page, as well as some titles (such as BottomTitle
in the example) inside a tcolorbox
, which also need to be print on every page, as can be understood from the MWE.
Now the question:
How to loop this, such that we have the following:
SomeImageName-1.jpg
(page 1, left)SomeImageName-17.jpg
(page 1, right)SomeImageName-2.jpg
(page 2, left)SomeImageName-18.jpg
(page 2, right)...-3.jpg
(p. 3 ......-19.jpg
(p. 3 ...and so forth untill
-16.jpg
(p. 16 ...and so forth untill
-32.jpg
(p. 16 ...
In short:
How to have a loop, such that multiple pages can be print, each loaded with 2 images per page, as per the loop description above?
Probably something with
\foreach \i in {\PictureIndexStartsAt,...,\PictureIndexEndsAt}{
\def\iPlusConstant{\the\numexpr\i+16}
- LEFT:
\includegraphics[width=\textwidth]{./Pictures/XYZ-\i.jpg}
- RIGHT:
\includegraphics[width=\textwidth]{./Pictures/XYZ-\iPlusConstant.jpg}
\newpage
How to piece this together into a loop which works with this MWE please?