0

I am not sure whether this question has been asked here before or the question is stupid to ask due to insufficient knowledge in how latex graphics actually work.

I add a picture using \includegraphics{1.jpg} now If I have a large number of images(finite), how can I insert those images in a single command or so? I mean what is easy and quick way to insert rather than writing \includegraphics{1.jpg}, \includegraphics{2.jpg}, \dots \dots, \includegraphics{n.jpg}?

Thanks!

Edit: Just after asking the question I saw this post but not sure if it is answering my query: How to insert multiple images in one figure using LaTeX?

  • the linked question might not do exactly what you need. What you need to do depends on what your document will look like. What I mean, is: will the images be placed on more than one page? Will you add captions? Do you need to refer to individual images in your text? Is there going to be running text between the individual images that you will add later on? In summary: a potential answerer needs more information as to what you will want to do with your document later on. Give an example of what you have in mind or (best) add an MWE so people can work on that. – thymaro Aug 23 '19 at 14:36
  • Well, very simple, imagine I have 2000 images from a trip, and I just want them to keep as a pdf book, each page will have one image say. – Marso Aug 23 '19 at 14:38
  • Do the image filenames follow a recognizable sequence (img1, img2 ...) or do you intend to input a list of image names? – Steven B. Segletes Aug 23 '19 at 14:43
  • 1
    image files names are 1.jpg, dot dot 2000.jpg – Marso Aug 23 '19 at 14:44
  • 1
    @Marso Your comment includes 4 dots .... but it should only be three ..., as in {1,2,...,2000} – Steven B. Segletes Aug 23 '19 at 14:51
3

easy with foeach:

\documentclass{article}

\usepackage{graphicx}
\usepackage{pgffor}

\begin{document}

\foreach \x in {1,2,...,3}{%
    \includegraphics[width=1cm]{\x}%
}%


\end{document}
|improve this answer|||||
  • @Marso re your attempted edit: Not fix height and width, at most one of them. And file type is not necessary, better remove it. Latex will know which type is best – wang ki wun Aug 23 '19 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.