Hlm
Hlm

Reputation: 21

Create a photo gallery in Latex

Which library should I use that will allow me to make a grid of pictures, same dimensions. Like 3 pictures per row. Is there an easy way to do that for like 30 pictures without worrying about each line alone. Thank you

Upvotes: 2

Views: 962

Answers (2)

Pietro Paparella
Pietro Paparella

Reputation: 111

A solution that utilizes the floatrow package.

\documentclass{article}
\usepackage{graphicx}                    
\usepackage{floatrow}
\usepackage{mwe}
\usepackage{showframe}
\usepackage{lipsum}

\begin{document}   

\lipsum[1-2]

\begin{figure}[H]
\begin{floatrow}[3]
\ffigbox{\includegraphics[width = 0.3\textwidth]{example-image-a}}{} 
\ffigbox{\includegraphics[width = 0.3\textwidth]{example-image-b}}{}
\ffigbox{\includegraphics[width = 0.3\textwidth]{example-image-c}}{}
\end{floatrow} 
\end{figure}

\lipsum[3]

\end{document}

MWE Screen Capture

Upvotes: 1

You could use something like this:

\documentclass{article}

\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{pgffor}
\usepackage{xcolor}

\newadjustimage{\myimage}{max size={.33\textwidth}{.33\textwidth}}%

\begin{document}

\def\imagelist{example-image, example-image-duck, example-image-a, example-image-b, example-image-10x16, example-image-16x10}

\noindent\foreach \x in \imagelist{%
  \makebox[.33\textwidth][c]{\myimage{\x}}\hfill%
}

\end{document}

enter image description here

Upvotes: 4

Related Questions