# New command, load multiple images

I have to load multiple images to my thesis. Its about 320 pictures to shortcut this, I want to make a new command to load them more flexible.

My basic idea was to create a new command with multiple agruments which will load all pictures in correct places becouse sequence is important. Pictures will be loaded from /gfx/part1..partn/ directories.

Pictures should be placed like on the attachment. Could anyone give me a little help if the idea is correct, or there is other, easier way to do this ?

Cheers, jilsu

• I am not quite sure what you are after. There is apackage trying to implement an interface to ease omplementation of graphics, but the must easy to change interface is the original interface with a little more typing. Your editor can help you saving typing effort. – Johannes_B Jan 6 '15 at 15:40
• Is your problem putting boxes with a finite size on the page? – Johannes_B Jan 6 '15 at 15:40
• If you just put 7 \includegraphics one after the other in a center environment you would get that layout. – David Carlisle Jan 6 '15 at 15:44
• @Johannes_B No its not about empty boxes. I want to load graphic files in places pic.1-7 – jilsu Jan 6 '15 at 15:56
• LaTeX is like LEGO, it does not care if a brick is red (a letter) or blue (an image). It just wants to know its size. – Johannes_B Jan 6 '15 at 16:11

If you need the same layout of seven pictures over and over again for part1 to partN and assuming the pictures in each of the /gfx/partx/ folders are called pic1 to pic7, the below code should give you an idea of a definition of a new command to help you out. Note: I have omitted label and caption from all but the first subfigure, but they may of course be included at leisure - provided the labels are constructed in a way they remain unique, i.e. including the #1 to get the parameter that was passed to the command.

\documentclass[draft]{article}

\usepackage{graphicx}
\usepackage{subcaption}

\newcommand{\includegraphicsset}[1]{%
\begin{figure*}
\centering
\begin{subfigure}[b]{\textwidth}
\centering
\includegraphics[width=\textwidth]{/gfx/part#1/pic1}
\caption[short]{the largest picture in the set}
\label{fig:set#1large}
\end{subfigure}
\\\vspace\baselineskip
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{/gfx/part#1/pic2}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{/gfx/part#1/pic3}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{/gfx/part#1/pic4}
\end{subfigure}
\\\vspace\baselineskip
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{/gfx/part#1/pic5}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{/gfx/part#1/pic6}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{/gfx/part#1/pic7}
\end{subfigure}
\caption{A set of pictures}
\label{fig:set#1}
\end{figure*}
}

\begin{document}
\includegraphicsset{1}
\includegraphicsset{2}
\end{document}


Using the Example-Image, this will give a layout like this:

Note: the aspect ratio of all the images is that of the original image, i.e. if your source image for the top image has the aspect ratio in your example that will be preserved with the above code.

• I am testing your code and there are some mistakes. I dont know if this is Texstudio problem or something else. The path do the files is visible in pdf file which is strange. I dont know why this is happend. – jilsu Jan 7 '15 at 16:15
• that's likely due to the draft option being set in \documentclass[draft]{article} - remove the [draft] part and the images should show up. – greyshade Jan 7 '15 at 16:18
• No, that was becouse I have spaces in my current directory for gfx. Yes, I forgot to mention it. I solved this one using \usepackage[space]{grffile} and now it works well. Thank you for your help. – jilsu Jan 7 '15 at 16:36

It is not really clear what your question is, \includegraphics can be placed or positioned in the same ways as any letter such as X in this case a simple center environment may be enough, although other possibilities of course:

\documentclass{article}

\usepackage{graphicx}

\begin{document}
\begin{center}
\setlength\lineskip{5pt}
\setlength\spaceskip{\fill}
\includegraphics[width=.8\textwidth]{example-image-16x9}
\includegraphics[width=.25\textwidth]{example-image-a}
\includegraphics[width=.25\textwidth]{example-image-b}
\includegraphics[width=.25\textwidth]{example-image-c}
\includegraphics[width=.3\textwidth]{example-image-a}
\includegraphics[width=.3\textwidth]{example-image-b}
\includegraphics[width=.3\textwidth]{example-image-c}
\end{center}
\end{document}