3

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

1 Answer 1

2

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

1
  • @Gozalo Medina This works perfect! Thank you a lot!
    – Ginger
    Commented Sep 8, 2013 at 20:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .