0

I'm using the subfig package and I'm getting words that are broken in captions. Can anyone explain why, or how to stop it?

\documentclass[11pt,a4paper, draft]{report}
\usepackage{gensymb}
\usepackage{graphicx}
\usepackage{subfig}
\begin{figure}[h!]
    \centering
    \subfloat[Sum frequency spectra taken at 18~\celsius\thinspace of a sample assembled from 18~\celsius\thinspace solution.]{\includegraphics[width=6cm, clip=true, trim=0cm 0cm 0cm 2cm]{TempHomeCold18}
        \label{fig:TempHomeCold18}}
    \qquad
    \subfloat[Sum frequency spectra taken at 18~\celsius\thinspace of a sample assembled from 35~\celsius\thinspace solution.]{\includegraphics[width=6cm, clip=true, trim=0cm 4cm 0cm 2cm]{TempHomeCold35}
        \label{fig:TempHomeCold35}}
    \qquad
    \subfloat[Sum frequency spectra taken at 18~\celsius\thinspace of a sample assembled from 40~\celsius\thinspace solution.]{\includegraphics[width=6cm, clip=true, trim=0cm 4cm 0cm 2cm]{TempHomeCold40}
        \label{fig:TempHomeCold40}}
    \qquad
    \subfloat[Sum frequency spectra taken at 18~\celsius\thinspace of a sample assembled from 45~\celsius\thinspace solution.]{\includegraphics[width=6cm, clip=true, trim=0cm 4cm 0cm 0cm]{TempHomeCold45}
        \label{fig:TempHomeCold45}}
    \qquad
    \caption Spectra obtained from hand-made samples on a cold stage.
\end{figure}

Which looks like this. The "S" of Spectra is on the first line, and the remainder of the captions is on the next line.

  • Welcome to TeX.SX! I can not reproduce your error. Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – LaRiFaRi Jun 11 '15 at 15:11
  • Off topic: You might want to have a look on `\documentclass{report} \usepackage{siunitx}

    \begin{document} \SI{18}{\celsius} \end{document}`

    – LaRiFaRi Jun 11 '15 at 15:15
  • 2
    Sorry, I got you wrong in the first place. Your error is that just S is handled as a caption. You have to write \caption{Spectra obtained ...} with braces all around it. – LaRiFaRi Jun 11 '15 at 15:18
  • Oops! I feel silly now. Thanks for your help! – user79959 Jun 11 '15 at 15:23

1 Answers1

1
% arara: pdflatex

\documentclass[11pt,a4paper]{report}
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage[caption=false]{subfig} % or use `\usepackage{subcaption}` which works better in combination with `hyperref`
\usepackage{siunitx}

\begin{document}
\begin{figure}[h!]
    \centering
    \subfloat[Sum frequency spectra taken at \SI{18}{\celsius} of a sample assembled from \SI{18}{\celsius} solution.]{\includegraphics[width=6cm, clip=true, trim=0cm 0cm 0cm 2cm]{TempHomeCold18}
        \label{fig:TempHomeCold18}}

    \subfloat[Sum frequency spectra taken at \SI{18}{\celsius} of a sample assembled from \SI{35}{\celsius} solution.]{\includegraphics[width=6cm, clip=true, trim=0cm 4cm 0cm 2cm]{TempHomeCold35}
        \label{fig:TempHomeCold35}}

    \subfloat[Sum frequency spectra taken at \SI{18}{\celsius} of a sample assembled from \SI{40}{\celsius} solution.]{\includegraphics[width=6cm, clip=true, trim=0cm 4cm 0cm 2cm]{TempHomeCold40}
        \label{fig:TempHomeCold40}}

    \subfloat[Sum frequency spectra taken at \SI{18}{\celsius} of a sample assembled from \SI{45}{\celsius} solution.]{\includegraphics[width=6cm, clip=true, trim=0cm 4cm 0cm 0cm]{TempHomeCold45}
        \label{fig:TempHomeCold45}}
    \caption{Spectra obtained from hand-made samples on a cold stage.} % <= you have forgotten those braces here. 
\end{figure}

% if you use a command without braces, just the next character is seen by the macro. Just try \textbf ab or \textit 12
\end{document}

enter image description here

LaRiFaRi
  • 43,807