I'm trying to center a table of images; 2 images per table row. Right now the code I have is ugly, and doesn't center on the document. I've tried using \begin{center} and \centering without any luck.
Also The way I created it, it currently creates a new table for every line. It's not ideal, but it the best I came up with so far. This is because I need to alternate text and images (for a caption effect, when I try to use the \caption I can't get the 2 column effect or the caption centers without the image and it's ugly)
Is there a way I can accomplish this considering there are about 100 images?
\begin{document}
stuff
stuff
stuff
\begin{center}
stuff that centers
stuff that centers
\figureLoop{pic(}{).jpg} %Doesn't center :(
stuff that centers
\end{center}
\end{document}
The first parameter is the front half of file name (separated by a number that increases in the loop) and the 2nd part is the rest of the file name.
\newcommand{\figureLoop}[2]
{
% Condition to loop; intitialized to true.
\bool_set_true:N \runWhileLoop
% Place holders
\int_zero:N \counter
\tmp=0
\Counter = \counter
% Run while condition is true
\bool_while_do:Nn {\runWhileLoop}
{
% Increment the counter
\int_incr:N \counter
\Counter = \counter
% Create file name from the counter
\edef\fileName{#1\int_use:N\counter#2}
% Increment for the 2nd column
\int_incr:N \counter
% Define the 2nd column figures/number
\edef\filename{#1\int_use:N\counter#2}
% Check if the file exists
\file_if_exist:nTF {\fileName}
{
% Check to see if the 2nd column file exists/is necessary
\file_if_exist:nTF {\filename}
{
\begin{table}[!htbp]
\begin{tabular}{c c}
\includegraphics[width=3.5cm]{\fileName} & \includegraphics[width=3.5cm]{\filename} \\
Image \number\Counter & Image \number\counter \\
\end{tabular}
\end{table}
}{
% If there's an odd number of photos
\begin{table}[!htbp]
\begin{tabular}{c}
\includegraphics[width=3.5cm]{\fileName} \\
Image \number\Counter \\
\end{tabular}
\end{table}
}
\advance\tmp by 1
\ifnum\tmp=4
\newpage
\tmp=0
\fi
}{
% there is no file with the given name
% break the loop
\bool_set_false:N \runWhileLoop
}
}
}
And this is what I currently get. This is the idea I want but centered completely. Any advice would be helpful, but I'd prefer something that has as little modification as possible.