3

I need to generate several frames which each contain an image. I was thinking of looping with \ foreach but it doesn't work

\foreach \nn in{1,2,...,5}{
\begin{frame}[fragile]{}
\includegraphics[width=0.8\textwidth]{cata-\nn.jpg}
\end{frame}
}

1 Answer 1

4

This works

\documentclass{beamer}
\usepackage{pgffor}
\begin{document}
\foreach \nn in{a,b,c,duck}{
\begin{frame}
\frametitle{Image \nn}
\centering
\includegraphics[width=0.8\textwidth]{example-image-\nn}
\end{frame}
}
\end{document}

enter image description here

2
  • Does not work with the fragile option... Commented May 20, 2020 at 6:16
  • @PaulGaborit Yes, that is correct. But one does not need fragile to "generate several frames which each contain an image".
    – user194703
    Commented May 20, 2020 at 6:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .