1

I am a newbie in Latex and I have 8 figures with equal sizes to plot. I want to arrange them in 4*2 and plot them in one page.

 \begin{figure}
    \begin{subfigure}[t]{0.32\textwidth}
        \includegraphics[width=\textwidth]{plots1.pdf}
    \end{subfigure}
    \hfill
    \begin{subfigure}[t]{0.32\textwidth}
        \includegraphics[width=\textwidth]{plots2.pdf}
    \end{subfigure}
    \\
    \begin{subfigure}[t]{0.32\textwidth}
        \includegraphics[width=\textwidth]{plots3.pdf}
    \end{subfigure}
    \hfill
    \begin{subfigure}[t]{0.32\textwidth}
        \includegraphics[width=\textwidth]{plots4.pdf}
    \end{subfigure}
     \\
     \begin{subfigure}[t]{0.32\textwidth}
        \includegraphics[width=\textwidth]{plots5.pdf}
    \end{subfigure}
    \hfill
    \begin{subfigure}[t]{0.32\textwidth}
        \includegraphics[width=\textwidth]{plots6.pdf}
    \end{subfigure}
     \\
     \begin{subfigure}[t]{0.32\textwidth}
        \includegraphics[width=\textwidth]{plots7.pdf}
    \end{subfigure}
    \hfill
    \begin{subfigure}[t]{0.32\textwidth}
        \includegraphics[width=\textwidth]{plots8.pdf}
    \end{subfigure}
\caption{blah blah blah blah ...}
\end{figure}

I want to do these:

  1. Reduce the horizontal distance between two subfigures to have equal distances between them and the edge of the page.
  2. Reduce the vertical distance between two subfigures so I may be able to increase the size of each of them. (The reason why I chose 0.32\textwidth is because I wanted to fit them all in one page. Do you have better idea to increase their width and height? They don't need to keep the ratio between width and height of the original images)
  3. Add subcaptions on the top-left (or left) of each image as a,b,c,d,...

I would really appreciate it if you can help me. Thanks a lot. Ali

5
  • Please provide a minimally working example, that includes a documentclass, etc. Something that someone can copy and compile without adding anything :)
    – J M
    Jun 30, 2016 at 5:08
  • 1
    Please tell us a bit more about the natural sizes of the images. E.g, in their natural size, are they about square, more tall than wide, or less tall than wide?
    – Mico
    Jun 30, 2016 at 5:20
  • see, if answer in tex.stackexchange.com/questions/316435/… can help you.
    – Zarko
    Jun 30, 2016 at 6:10
  • Your stated objective, "Reduce the vertical distance between two subfigures", is a bit puzzling as there is virtually no (vertical) separation in your code at present. Please clarify.
    – Mico
    Jun 30, 2016 at 7:28
  • @Mico Thanks for your comment. my problem is solved. I used the below codes with some \vspace and \hspace.
    – Alirsd
    Jun 30, 2016 at 13:47

1 Answer 1

3

Probably you looking for something like this:

enter image description here

For this figure I use subfig and floatrow packages:

\documentclass{article}
\usepackage{floatrow}
\usepackage{graphicx}
\usepackage[label font=bf,labelformat=simple]{subfig}
\usepackage{caption}
\floatsetup[figure]{style=plain,subcapbesideposition=top}

\usepackage[showframe]{geometry}

\begin{document}
%---------------------------------------------------------------%
    \begin{figure}[htbp]
    \centering
\sidesubfloat[]{\includegraphics[width=0.4\textwidth]{example-image}\label{fig:a}}
\hfil
\sidesubfloat[]{\includegraphics[width=0.4\textwidth]{example-image}\label{fig:b}}

\medskip
\sidesubfloat[]{\includegraphics[width=0.4\textwidth]{example-image}\label{fig:c}}
\hfil
\sidesubfloat[]{\includegraphics[width=0.4\textwidth]{example-image}\label{fig:d}}

\medskip
\sidesubfloat[]{\includegraphics[width=0.4\textwidth]{example-image}\label{fig:e}}
\hfil
\sidesubfloat[]{\includegraphics[width=0.4\textwidth]{example-image}\label{fig:f}}

\medskip
\sidesubfloat[]{\includegraphics[width=0.4\textwidth]{example-image}\label{fig:g}}
\hfil
\sidesubfloat[]{\includegraphics[width=0.4\textwidth]{example-image}\label{fig:h}}
\caption{Main caption \dots}
    \label{fig:myfigure}
    \end{figure}
\end{document}
2
  • Thank you so so so much. This is exactly what I wanted. I have two quick questions: Do you know if there is a way to have labels as (a), (b),... than a,b, in this setting? How can I change width and height simultaneously. I don't need to have the same ratio as the original picture. Thanks again
    – Alirsd
    Jun 30, 2016 at 13:43
  • 1
    Form of labels is determined by labelformat=..... I select optionsimple (which is default), if you select parens you should gives what you looking for. Nex question I don't understand well. If your images are different size and like to show them in the same size, then >(as far as i know) is not such (direct) possibilities
    – Zarko
    Jun 30, 2016 at 14:36

You must log in to answer this question.

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