[Tex/LaTex] Title in subfloat without line-break

captionsline-breakingsubfloats

My code is like this, but the title of subfigure is with line-break, which looks very ugly? How can I solve it?

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

enter image description here

Best Answer

You can make the figure a little wider by using some spaces to its left and right (I removed some spurious blank spaces from your code):

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

enter image description here

Another option is to use the width option for \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}

enter image description here