# Captions of two figures side-by-side in a minipage

Considering the below code, I am trying to put two figures side by side in a minipage by two separated captions. The problem that I am facing is that the captions have overlaps (caption of figure at right side covers the one at the left one if the caption is longer than few words.). If i use the default spacing, figures overlap too. To prevent captions and figures to overlap, I have tried to make space between figures but it will exceed the page length and will not be an ultimate solution for long captions. These are besides the fact that figures are not aligned.

\documentclass[smallextended]{svjour3}

\usepackage{graphicx}

\begin{document}

\begin{figure*}[!htb]
\centering
\begin{minipage}{0.5\textwidth}
\centering
\includegraphics[scale=0.35]{sample.jpg}
\caption{This is a caption} \label{this is a label}
\end{minipage}%
\begin{minipage}{0.8\textwidth}
\centering
\includegraphics[scale=0.35]{sample2.jpg}
\caption{caption 2.} \label{label 2}
\end{minipage}
\end{figure*}
\end{document}


Consequently, I welcome any contra active solution!

• sum of the widths of your minipages is bigger than text width ... please extend your code snipet to complete small document, which we can test. please help us to help you! – Zarko Nov 29 '18 at 15:16
• @Zarko I am using a journal template. How to make it accessible in MWE? – lonesome Nov 29 '18 at 15:24
• if i tested your code with standard article, assuming that your document has two columns, i can't confirm your findings. there is not overlap of captions, however image is spill out of page because your mini pages is to wide. can you show image of your result? first try correct widths of your minipages ... – Zarko Nov 29 '18 at 15:30
• sory, i will not do your task, this is up to you. simply i can't reproduce your problem. please provide mwe, which will demonstrate your problem. in my test i have 21 lines long caption and text are not overlap. – Zarko Nov 29 '18 at 15:35
• @Zarko I have added a photo. – lonesome Nov 29 '18 at 15:36

## 1 Answer

your question, also after adding a photo of your result is not clear at all. i assume that you have two columns article, which has figure over both column. in placing of your images you make two errors:

• sum of the both mini pages is 1.3\textwidth. consequently the second image spill out of page (as i told you in my comments)
• you scale image size with some factor, which is not depend on available space in mini pages, so the images can become bigger than mini pages ...

in the following mwe i add \fbox around mini pages that their border is visible. as you can see, there is no overlapping of images nor captions nor images' spilling out of mini page nor page.

(red lines indicate page layout. for images i use test image from duckumemnts package since haven't yours)

my test mwe:

\documentclass[twocolumn]{article}
\usepackage{geometry}
\usepackage[export]{adjustbox} % it also load graphics page

%-------------------------------------- only for show page layout
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.25pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}

\begin{document}
\lipsum[1-5]
\begin{figure*}
\centering
\fbox{%
\begin{minipage}[t]{0.47\linewidth}
\centering
\includegraphics[scale=0.35]{example-image-duck}
\caption{\lipsum[11]} \label{this is a label}
\end{minipage}%
}
\hfill
\fbox{%
\begin{minipage}[t]{0.47\linewidth}
\centering
\includegraphics[scale=0.35]{example-image-duck}
\caption{caption 2.} \label{label 2}
\end{minipage}
}
\end{figure*}
\lipsum
\end{document}


edit: i test my mwe with \documentclass{scjour3} (on overleaf). the result is:

(in test i use example-image-a and example-image-b, and for float environment figure, since your document is one column only)

as you can see, mwe works with any problem. so it is not clear what is your problem. mwe works as "adverised" :-)

• this is not true. test my with using \lipsum[12] for the second caption. since \lipsum[12] is longer than \lipsum[11] the second caption has three more lines. – Zarko Nov 29 '18 at 16:45
• This is probably due to the different document classes that we are using. – lonesome Nov 29 '18 at 16:47
• in this i cant help you since you hide essential information about your document. so far as i know my mwe should work in any \documentclass . – Zarko Nov 29 '18 at 16:56
• @samcarter, thank you very much for correction of my answer. in my MikTeX installation it seems that graphicx call the duckumemnts package ... – Zarko Nov 29 '18 at 18:41
• @Zarko graphicx neither calls the mwe nor the duckuments package. These two packages contain images, which can automatically be found, but it is not necessary to load the packages to use the images. – samcarter_is_at_topanswers.xyz Dec 6 '18 at 22:46