标题为子浮动格式,无换行

标题为子浮动格式,无换行

我的代码是这样的,但是子图的标题有换行,看起来很丑?我该如何解决?

\begin{figure}[!ht]
 \centering
\subfloat[Subgraph]{
\label{fig:subg}
\includegraphics[width=0.2\textwidth]{subg.eps}
}\qquad
\subfloat[Induced subgraph]
{
\includegraphics[width=0.2\textwidth]{indsubg.eps}
}
\caption{Subgraph and induced subgraph.}
\label{fig:ind}
\end{figure}

在此处输入图片描述

答案1

您可以通过在图形左右两侧添加一些空格来使图形稍微宽一些(我从您的代码中删除了一些虚假的空白):

\documentclass{article}
\usepackage{subfig}
\usepackage{graphicx}

\begin{document}

\begin{figure}[!ht]
\centering
\subfloat[Subgraph]{%
  \label{fig:subg}
  \includegraphics[width=0.2\textwidth]{example-image-a}
}\qquad
\subfloat[Induced subgraph]{%
  \hspace*{4pt}%
  \includegraphics[width=0.2\textwidth]{example-image-b}
  \hspace*{4pt}%
}
\caption{Subgraph and induced subgraph.}
\label{fig:ind}
\end{figure}

\end{document}

在此处输入图片描述

另一个选择是使用该width选项\captionsetup

\documentclass{article}
\usepackage{subfig}
\usepackage{graphicx}

\begin{document}

\begin{figure}[!ht]
\centering
\captionsetup[subfigure]{width=80pt}%
\subfloat[Subgraph]{%
  \label{fig:subg}
  \includegraphics[width=0.2\textwidth]{example-image-a}
}\qquad
\captionsetup[subfigure]{width=80pt}%
\subfloat[Induced subgraph]{%
  \includegraphics[width=0.2\textwidth]{example-image-b}
}
\caption{Subgraph and induced subgraph.}
\label{fig:ind}
\end{figure}

\end{document}

在此处输入图片描述

相关内容