1

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.

Sequence of pictures

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

5
  • 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
    Commented Jan 6, 2015 at 15:40
  • Is your problem putting boxes with a finite size on the page?
    – Johannes_B
    Commented Jan 6, 2015 at 15:40
  • If you just put 7 \includegraphics one after the other in a center environment you would get that layout. Commented Jan 6, 2015 at 15:44
  • @Johannes_B No its not about empty boxes. I want to load graphic files in places pic.1-7
    – jilsu
    Commented Jan 6, 2015 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
    Commented Jan 6, 2015 at 16:11

2 Answers 2

3

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: example

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.

3
  • 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
    Commented Jan 7, 2015 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
    Commented Jan 7, 2015 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
    Commented Jan 7, 2015 at 16:36
2

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:

enter image description here

\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}
0

You must log in to answer this question.

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