0

I have about 400 images namely 1.jpg,2.jpg etc. I want to arrange it in grid. I don't want any captions or margins. Is there any easy way to achieve this

I don't need any space between images. A 3x4 grid will be fine

  • 1
    Could you add more information: grid size, the space between images, your margin settings, etc.? In other word: a minimal example code is necessary here. – user156344 Apr 9 '19 at 12:36
  • you can start with: \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture} \node (A) at(0,0) {}; \node [right = 1cm of A] (B){}; \foreach \x in {1,3,...,399} \node [below = \x cm of A] {\includegraphics[width=0.5cm, height=0.5cm]{example-image}}; \foreach \x in {1,3,...,399} \node [below = \x cm of B] {\includegraphics[width=0.5cm, height=0.5cm]{example-image-duck}}; \end{tikzpicture} \end{document}. – Raaja_is_at_topanswers.xyz Apr 9 '19 at 12:44
  • However, I really would not attempt inserting that many images. Because, I am afraid that you may run-over the page-limits. The code was borrowed from: %tex.stackexchange.com/questions/471465/… – Raaja_is_at_topanswers.xyz Apr 9 '19 at 12:45
3

your question is not very clear and seems to be duplicate to many similar question here. You need to put some small effort in search this site ... anyway, you can start with the following approach:

\documentclass{article}
\usepackage{graphicx}

\begin{document}
\begin{figure}[htbp]
  \centering
\setkeys{Gin}{width=0.3\linewidth}
  \includegraphics{example-image-duck}\,%
  \includegraphics{example-image-duck}\,%
  \includegraphics{example-image-duck}

  \includegraphics{example-image-duck}\,%
  \includegraphics{example-image-duck}\,%
  \includegraphics{example-image-duck}

  \includegraphics{example-image-duck}\,%
  \includegraphics{example-image-duck}\,%
  \includegraphics{example-image-duck}

  \includegraphics{example-image-duck}\,%
  \includegraphics{example-image-duck}\,%
  \includegraphics{example-image-duck}
\end{figure}
\end{document}

enter image description here

addendum: in the case, that name of images' files are 1, 2, ... 396 and you like to present them in 33 groups of 12 images (33 x 12 = 396) per figure organised in array 3 x 4 images you can make above example shorter with use two loops:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{pgffor}  % <---

\begin{document}
\begin{figure}[htbp]
\def\kk{2} % number of images group 1, 2, ... 33
\foreach \i [count=\k from 5+4*(\kk-1)] in {1,...,4}% <--- for rows
{
\foreach \j in {1,2,3}{\pgfmathparse{int(3*(\k-1)+\j)}% <--- for columns
                       \includegraphics[width=0.32\linewidth]{\pgfmathresult}%
                        \ifnum\j<3\,\else\fi%
                       }
}
\end{figure}
\end{document}
| improve this answer | |
  • Thanks. What if the image names are JPG001.jpg,JPG002.jpg etc – Arun Apr 12 '19 at 13:50
  • 1
    @Arun, if imeges with number greater than 9 has name JPG0010, JPG0011, ... than before \pgfmathresult ad "JPG00". if those names are JPG010, JPG011, than the second example is not so simple anymore . to solve this problem is the best to ask new question (with more information as this has) what you like to obtain. also provide in it an mwe, which illustrate your problem. – Zarko Apr 12 '19 at 14:32

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.