[Tex/LaTex] Subfigure captions appear too close together

floatsgraphics

Is there anyway to avoid what is observed below with the subfigure captions appearing too close together?

I would rather not use the minipage environment as a solution.

\documentclass[]{article}
\usepackage{graphicx}

\usepackage{caption}

\usepackage{subcaption}
\usepackage{subfig}


\begin{document}

\begin{figure}[h!]
  \begin{subfigure}[t]{.5\textwidth}
  \centering
    \includegraphics[width=50mm]{image1.png}
    \caption{Test 1 - text filling out page so it is possible to view the how close the text regions get. I will keep going to show that in the second line.}
  \end{subfigure}%
  \begin{subfigure}[t]{.5\textwidth}
  \centering
    \includegraphics[width=50mm]{image2.png}
    \caption{Test 2 - text filling out page so it is possible to view the how close the text regions get}
  \end{subfigure}
  \caption{Full caption}
\end{figure}

\end{document}

enter image description here

Best Answer

Just use a shorter width for the subfigure:

\documentclass[]{article}
\usepackage[demo]{graphicx} % demo is just for the example

\usepackage{caption}

\usepackage{subcaption}


\begin{document}

\begin{figure}[h!]
  \begin{subfigure}[t]{.45\textwidth}
  \centering
    \includegraphics[width=.9\textwidth]{image1.png}
    \caption{Test 1 - text filling out page so it is possible to view the how close the text regions get. I will keep going to show that in the second line.}
  \end{subfigure}\hfill
  \begin{subfigure}[t]{.45\textwidth}
  \centering
    \includegraphics[width=.9\textwidth]{image2.png}
    \caption{Test 2 - text filling out page so it is possible to view the how close the text regions get}
  \end{subfigure}
  \caption{Full caption}
\end{figure}

\end{document}

Don't load subfig along with subcaption. Also specifying a fixed width like 50mm is not good, because you might exceed the width for the subfigure.

enter image description here