I have a centered subfigure with 2 images with 2 caption like so
they are made with the following code
\documentclass[12pt,a4paper]{article}
\usepackage[a4paper,margin=1in]{geometry}
\begin{figure}[H]
\begin{center}
\begin{subfigure}[t]{0.4\textwidth}
\includegraphics[width=\textwidth]{04 Introduction/figurer/Quiescent_galaxies_allz_UVJ_classic.png}
\caption{Quiescent galaxies in UVJ colors from the Classic catalog plotted against redshift in bins of approximately 2 billion years.}
\label{fig:cq_uvj}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.4\textwidth}
\includegraphics[width=\textwidth]{04 Introduction/figurer/Quiescent_galaxies_allz_UVJ_farmer.png}
\centering\caption{\hspace{0pt} Quiescent galaxies in UVJ colors from the Farmer catalog plotted against redshift in bins of approximately 2 billion years.}
\label{fig:fq_uvj}
\end{subfigure}
\caption{}
\label{fig:cfq_uvj}
\end{center}
\end{figure}
However, the caption for each image is not hyphenated. How can I split up the words so they align nicely?
Best Answer
If you load the
ragged2e
package, the optionjustfication=RaggedRight
(note the two uppercase-R letters) becomes available to\captionsetup
. The difference betweenjustfication=RaggedRight
andjustfication=raggedright
is that the former allows hyphenation of the caption text.