4

I have used standalone to generate this picture:

enter image description here

I would like to put C and D below A and B and aligned them. Is there a simple command line? Thank you very much for your time!

Here is my code:

\documentclass[12pt,a4paper,twoside]{standalone}
\usepackage{graphicx}
\usepackage{caption,subcaption}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{pgfplots}

\begin{document}
  \begin{figure}[htbp]
  \captionsetup[subfigure]{singlelinecheck=off,labelfont={bf}}
  \renewcommand\thesubfigure{\Alph{subfigure}}
    \begin{subfigure}{0.5\linewidth}
      \centering
      \includegraphics[width=\linewidth]{Figure2a}
      \caption{}
    \end{subfigure}%
    \begin{subfigure}{0.5\linewidth}
      \centering
      \includegraphics[width=\linewidth]{Figure2b}
      \caption{}
    \end{subfigure}

    \vspace{1cm}
    \begin{subfigure}{0.5\linewidth}
      \centering
      \includegraphics[width=\linewidth]{Figure2c}
      \caption{}
    \end{subfigure}%
    \begin{subfigure}{0.5\linewidth}
      \centering
      \includegraphics[width=\linewidth]{Figure2d}
      \caption{}
    \end{subfigure}

  \end{figure}
\end{document}

Figure A:

enter image description here

Figure B

enter image description here

Figure C

enter image description here

Figure D

enter image description here

EDIT:

Here is my new code, which is a lot better than my previous one:

\documentclass[12pt,a4paper,twoside]{standalone}
\usepackage{graphicx}
\usepackage{caption,subcaption}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{pgfplots}
\graphicspath{{./Figures/}}
\begin{document}

\begin{table}[htbp]
\begin{tabular}{cc}
    \includegraphics[width=\textwidth]{Figure3a.png} &
    \includegraphics[width=\textwidth]{Figure3b.png} &\\
    \includegraphics[width=\textwidth]{Figure3c.png} &
    \includegraphics[width=\textwidth]{Figure3d.png}
\end{tabular}
\end{table}
\end{document}

I get the following:

enter image description here

I would greatly appreciate if someone could please show me how to add subcaptions (e.g. A, B, C, D) from left to right. Thank you!

4
  • 1
    there is no need to figure environment. You can use tabular environment and may be caption package if you need captions.
    – touhami
    Commented Apr 24, 2015 at 18:55
  • You would have to use two \includegraphics and crop half the image each time. Commented Apr 24, 2015 at 19:04
  • If you use a minipage inside standalone, you can arrange them vertically as well as horizontally. That won't help with the captions, though. Commented Apr 24, 2015 at 19:06
  • @touhami Thank you! It worked well! I have edited the code. However, I am still stuck at the caption.
    – Johnathan
    Commented Apr 24, 2015 at 19:54

2 Answers 2

3

I am not sure that this code will be useful to you?

\documentclass[12pt,a4paper,twoside]{standalone}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{pgfplots}
\begin{document}        
\begin{tabular}{l l}
\includegraphics[width=\textwidth]{Figure3a.png} &
\includegraphics[width=\textwidth]{Figure3b.png} \\
{\Large\textbf{(A)}} & {\Large\textbf{(B)}} \\
\includegraphics[width=\textwidth]{Figure3c.png} &
\includegraphics[width=\textwidth]{Figure3d.png} \\
{\Large\textbf{(C)}} & {\Large\textbf{(D)}} \\
\end{tabular}
\end{document}
0
2

Use the varwidth option.

In the example I used .9\linewidth to emulate your images, because otherwise the example images would be squashed to one another horizontally. Also border=4 is for the same reason: the upper images would be too near the top. Such problems would not be present with your images, probably.

I'd recommend setting a margin for the subcaptions.

\documentclass[12pt,a4paper,varwidth,border=4]{standalone}
\usepackage{graphicx}
\usepackage{caption,subcaption}

\captionsetup[subfigure]{singlelinecheck=off,labelfont={bf}}
\renewcommand\thesubfigure{\Alph{subfigure}}

\begin{document}
\begin{figure}
\begin{subfigure}{0.5\linewidth}
\centering
\includegraphics[width=.9\linewidth]{example-image-a}
\caption{}
\end{subfigure}%
\begin{subfigure}{0.5\linewidth}
\centering
\includegraphics[width=.9\linewidth]{example-image-b}
\caption{}
\end{subfigure}

\vspace{1cm}
\begin{subfigure}{0.5\linewidth}
\centering
\includegraphics[width=.9\linewidth]{example-image-c}
\caption{}
\end{subfigure}%
\begin{subfigure}{0.5\linewidth}
\centering
\includegraphics[width=.9\linewidth]{example-image}
\caption{}
\end{subfigure}

\end{figure}
\end{document}

enter image description here

You must log in to answer this question.

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