使用 subfig 时,图片标题出现换行问题

使用 subfig 时,图片标题出现换行问题

我正在使用 subfig 包,但字幕中的单词却不完整。有人能解释一下原因吗,或者如何解决?

\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}

看起来像。Spectra 的“S”位于第一行,其余标题位于下一行。

答案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}

在此处输入图片描述

相关内容