我的代码是这样的,但是子图的标题有换行,看起来很丑?我该如何解决?
\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}