9

I've been working on how to put side by side figures with captions for a book but haven't managed to find a way to put a horizontal space in between the two figures. There has been some troubles ever since I started using PDF images, so I just thought to mention it just in case.

I am using the minipage solution so far to manage this but I don't know how to go further than this. Any help or advices will be appreciated.

\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage[paperwidth=6in, paperheight=9in, margin=0.9in, showframe]{geometry}
\usepackage{lipsum}
\begin{document}

\begin{figure}
\centering
\begin{minipage}{.5\textwidth}
\centering
\includegraphics[width=1\linewidth]{camellia}
\captionof{figure}{an evergreen eastern Asian shrub related to the tea plant, grown for its showy flowers and shiny leaves.}
\label{camellia}
\end{minipage}%
\begin{minipage}{.5\textwidth}
\centering
\includegraphics[width=1\linewidth]{rose}
\captionof{figure}{a prickly bush or shrub that typically bears red, pink, yellow, or white fragrant flowers, native to north temperate regions. Numerous hybrids and cultivars have been developed and are widely grown as ornamentals.}
\label{rose}
\end{minipage}
\end{figure}

\lipsum
\end{document}

Image: output

What I want to obtain is this:

enter image description here

I haven't mentioned it in the titles but I would also like to make the captions inline to each other. And the images sitting on the same line like this too:

enter image description here

1
  • unrelated but you can use \caption no need for \captionof inside a figure Jan 12, 2016 at 21:41

2 Answers 2

9

enter image description here

\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage[paperwidth=6in, paperheight=9in, margin=0.9in, showframe]{geometry}
\usepackage{lipsum}
\begin{document}

\begin{figure}
\centering
\begin{minipage}{.4\textwidth}
\centering
\includegraphics[width=1\linewidth]{example-image}
\end{minipage}\qquad
\begin{minipage}{.4\textwidth}
\centering
\includegraphics[width=1\linewidth]{example-image-golden-upright}
\end{minipage}

\bigskip

\begin{minipage}[t]{.4\textwidth}
\centering

\caption{an evergreen eastern Asian shrub related to the tea plant, grown for its showy flowers and shiny leaves.}
\label{camellia}
\end{minipage}\qquad
\begin{minipage}[t]{.4\textwidth}
\centering
\caption{a prickly bush or shrub that typically bears red, pink, yellow, or white fragrant flowers, native to north temperate regions. Numerous hybrids and cultivars have been developed and are widely grown as ornamentals.}
\label{rose}
\end{minipage}
\end{figure}

\lipsum
\end{document}
0
7

Just reserve the wanted space to the minipages; with \dimexpr it's easy to fix the space in between the images (here to 2 ems).

Note that you don't need \captionof. With \begin{minipage}[t] you ensure alignment with respect to the bottom of the pictures.

\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage[paperwidth=6in, paperheight=9in, margin=0.9in, showframe]{geometry}
\usepackage{lipsum}
\begin{document}

\begin{figure}
\centering
\begin{minipage}[t]{\dimexpr.5\textwidth-1em}
\centering
\includegraphics[width=\textwidth]{example-image-9x16}

\caption{an evergreen eastern Asian shrub related to the tea plant,
grown for its showy flowers and shiny leaves.}\label{camellia}
\end{minipage}\hfill
\begin{minipage}[t]{\dimexpr.5\textwidth-1em}
\centering
\includegraphics[width=\textwidth]{duck}

\caption{a prickly bush or shrub that typically bears red, 
pink, yellow, or white fragrant flowers, native to north 
temperate regions. Numerous hybrids and cultivars have been 
developed and are widely grown as ornamentals.}\label{rose}
\end{minipage}
\end{figure}

\lipsum
\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 .