3

I followed a tutorial I saw on this website, but the captions don't look right because they are too long.

This is the code I used:

\begin{figure}[h]
\centering
\begin{minipage}{.5\textwidth}
    \centering
    \includegraphics[height=5cm,keepaspectratio]{figures/chapter_3/p_type_materials_2012.png}
    \captionof{figure}{Figure of merit of p-type semiconductors}
    \label{fig:p-type-zT}
\end{minipage}%
\begin{minipage}{.5\textwidth}
    \centering
    \includegraphics[height=5cm,keepaspectratio]{figures/chapter_3/n_type_materials_2012.png}
    \captionof{figure}{Figure of merit of n-type semiconductors}
    \label{fig:n-type-zT}
\end{minipage}
\end{figure}

And it looks like this: The captions are too close together

How can I correct this? How can I add a space in between or, if not possible for instance, send the "semicon-" to the next line? Thanks in advance!

aaa
  • 161
  • 1
    Make both minipages smaller (0.45\textwidthfor example) and add \hfill between them. – leandriis Mar 24 '20 at 16:47
  • @leandriis a empty space instead of the % should sufficient, no ? – BambOo Mar 24 '20 at 16:48
  • 1
    @BambOo: It depends on the width and the desired output. Without the \hfill the cpations might still end up quite close to each other. – leandriis Mar 24 '20 at 16:50
  • reduce font size for caption – js bibra Mar 24 '20 at 17:09
  • 4
    @jsbibra: This will cause inconsistencies thoroughout the document and one would have to reduce the font size quite a lot to actually get some space between the captions. To summarize: I wouldn't recommend that. – leandriis Mar 24 '20 at 17:33

1 Answers1

4

Some suggestions and comments:

  • Get rid of all 3 \centering directives.

  • Reduce the widths of both minipage environments from 0.5\textwidth to 0.45\textwidth. (Use

  • Insert the directive \hfill at the end of the first minipage environment.

  • In the list of optional arguments of both \includegraphics statements, replace height=5cm with width=\textwidth.

  • Replace both instances of \captionof{figure} with \caption.

enter image description here

\documentclass{article}
\usepackage[demo]{graphicx} % remove 'demo' option in real doc.

\begin{document}
\begin{figure}[h]

\begin{minipage}{.45\textwidth}
    \includegraphics[width=\textwidth,keepaspectratio]{figures/chapter_3/p_type_materials_2012.png}
    \caption{Figure of merit of p-type semiconductors}
    \label{fig:p-type-zT}
\end{minipage}\hfill
\begin{minipage}{.45\textwidth}
    \includegraphics[width=\textwidth,keepaspectratio]{figures/chapter_3/n_type_materials_2012.png}
    \caption{Figure of merit of n-type semiconductors}
    \label{fig:n-type-zT}
\end{minipage}
\end{figure}
\end{document}
Mico
  • 506,678