Graphics, Figures & TablesLooping through a folder and inserting all figures

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
gokotai
Posts: 5
Joined: Thu Aug 11, 2022 12:35 pm

Looping through a folder and inserting all figures

Post by gokotai »

Hi folks,
I have a folder within overleaf of 65 images, which I'd like to include as figures in the document.
However, I'm having some trouble with calling the for loop. May I ask for some assistance in finding what I've done wrong please?

Code: Select all

\newcommand*{\samples}
{
AFCO 01-JAN-19, 
AFCO 02-NOV-18, 
AFCO 03-APR-19, 
AFCO 03-JAN-19, 
AFCO 03-OCT-18, 
AFCO 05-DEC-18, 
AFCO 05-JUL-18, 
AFCO 05-MAR-19, 
AFCO 05-NOV-18, 
AFCO 06-FEB-19, 
AFCO 09-JAN-19, 
AFCO 12-DEC-18, 
AFCO 13-DEC-18, 
AFCO 14-MAR-19, 
AFCO 14-OCT-18, 
AFCO 17-DEC-18, 
AFCO 24-NOV-18, 
AFCO 27-DEC-18, 
AFCO 27-NOV-18, 
AFCO 28-FEB-19, 
AFCO 30-DEC-18, 
AFCO 30-JAN-19, 
AUS 100\% #1, 
BLUESCOPE, 
BUSTY BLEND #1, 
BUSTY FINES #2,
BUSTY IN BASE #1, 
COKE BREEZE BLEND #1, 
COLOMBIAN, 
FYF, 
IJmuiden 50CRI, 
MORFA,02-FEB-21, 
MORFA 14-JAN-21, 
MORFA 16-JAN-21, 
MORFA 18-JAN-21, 
MORFA 21-JAN-21, 
MORFA 29-JAN-21, 
MORFA FLOAT 02-FEB-21, 
MORFA FLOAT 23-02-21, 
MORFA FLOAT 3-FEB-21, 
MORFA FLOAT 27-JAN-21, 
MORFA FLOAT 28-JAN-21, 
MORFA FLOAT 30-JAN-21, 
MORFA GROUND 1, 
MORFA GROUND 2, 
MORFA GROUND 3, 
MORFA GROUND 4, 
MORFA GROUND 5, 
MORFA GROUND 6, 
MORFA GROUND 7, 
MORFA SINK 23-FEB-21, 
MORFA SINK 24-FEB-21, 
MORFA SINK 27-JAN-21, 
MORFA SINK 28-JAN-21, 
MORFA SINK 30-JAN-21, 
MORFA WK 1, 
MORFA WK 39, 
MORFA WK 4,
MORFA WK 8, 
POLISH 100\% #2, 
REF 3 BLEND 2, 
RISUN 10-JUL-18, 
RISUN ERINI P, 
US LV 50-50, 
US MV
}

Code: Select all

\begingroup
\foreach \x in {\samples}
  {\includegraphics[width=20mm]{figures/testFolder/\x.png}\hspace{0pt}{}
\endgroup

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gokotai
Posts: 5
Joined: Thu Aug 11, 2022 12:35 pm

Looping through a folder and inserting all figures

Post by gokotai »

used \samples instead of {\samples}
Post Reply