子图中的标题默认是两端对齐的,但看起来并不总是很漂亮:
\documentclass[]{tGIS2e} % http://www.tandf.co.uk/journals/authors/tgislatex.zip
\begin{document}
\begin{figure}
\begin{center}
%\raggedright
\subfigure[caption for a]{
\includegraphics[draft,width=3cm,height=3cm]{dummy}%
\label{fig:myfig_a}%
}
~
\subfigure[capture for b, justified]{
\includegraphics[draft,width=3cm,height=3cm]{dummy}%
\label{fig:myfig_b}%
}
~
\subfigure[justification becomes ugly sometimes]{
\includegraphics[draft,width=3cm,height=3cm]{dummy}%
\label{fig:myfig_c}%
}
~
\subfigure[there should be a way of applying \textbackslash raggedright or a similar command ]{
\includegraphics[draft,width=3cm,height=3cm]{dummy}%
\label{fig:myfig_d}%
}
\caption{Figure example}%
\label{fig:myfig}
\end{center}
\end{figure}
\end{document}
如何才能保持图像和其标题的整体对齐,并使子标题对齐,比如说左对齐?添加\raggedright
没有帮助——它使整个图像向左移动,但保持文本的对齐。
如果解决方案针对上面给出的标记退出就好了,因为我使用的模板不支持subfigure
环境并且与subcaption
包冲突。
答案1
您的 documentclass 正在加载(过时的)subfigure
包。此包具有诸如raggedright
标题对齐之类的选项。可以通过发出以下命令在本地启用这些选项\subcapraggedrighttrue
:
\documentclass[]{tGIS2e}
\begin{document}
\begin{figure}
\begin{center}
\subcapraggedrighttrue
\subfigure[caption for a]{
\includegraphics[width=3cm,height=3cm]{example-image-a}%
\label{fig:myfig_a}%
}
~
\subfigure[capture for b, justified]{
\includegraphics[width=3cm,height=3cm]{example-image-a}%
\label{fig:myfig_b}%
}
~
\subfigure[justification becomes ugly sometimes]{
\includegraphics[width=3cm,height=3cm]{example-image-a}%
\label{fig:myfig_c}%
}
~
\subfigure[there should be a way of applying \textbackslash raggedright or a similar command ]{
\includegraphics[width=3cm,height=3cm]{example-image-a}%
\label{fig:myfig_d}%
}
\caption{Figure example}%
\label{fig:myfig}
\end{center}
\end{figure}
\begin{figure}
\begin{center}
\subcapcentertrue
\subfigure[caption for a]{
\includegraphics[width=3cm,height=3cm]{example-image-a}%
\label{fig:myfig_a}%
}
~
\subfigure[capture for b, justified]{
\includegraphics[width=3cm,height=3cm]{example-image-a}%
\label{fig:myfig_b}%
}
~
\subfigure[justification becomes ugly sometimes]{
\includegraphics[width=3cm,height=3cm]{example-image-a}%
\label{fig:myfig_c}%
}
~
\subfigure[there should be a way of applying \textbackslash raggedright or a similar command ]{
\includegraphics[width=3cm,height=3cm]{example-image-a}%
\label{fig:myfig_d}%
}
\caption{Figure example}%
\label{fig:myfig}
\end{center}
\end{figure}
\end{document}
可能的命令列表包括
\subcapraggedrighttrue
\subcapcentertrue
\subcapcenterlasttrue
此外,还有false
变体。
同样,要\subcaphangtrue
确保标签突出到标题块的左侧。例如,在上面的例子中
\subcapraggedrighttrue
\subcaphangtrue
给
选项也nooneline
对应于\subcapnoonelinetrue
。请参阅Declaration of Options
subfigure
文档,您将能够推断如何将标题放在图形上方而不是下方,等等。
答案2
如果您不介意标题相对于(a)
、、(b)
...标签偏移,也不介意指定标题宽度,那么这可以起作用。
\documentclass{article}
\usepackage{subfigure}
\usepackage[demo]{graphicx}
\textwidth 6in
\newcommand\tparbox[2]{\protect\parbox[t]{#1}{\protect\raggedright #2}}
\begin{document}
\begin{figure}
\begin{center}
\subfigure[\tparbox{2.5cm}{caption for a}]{
\includegraphics[draft,width=3cm,height=3cm]{dummy}%
\label{fig:myfig_a}%
}
~
\subfigure[\tparbox{2.5cm}{capture for b, justified}]{
\includegraphics[draft,width=3cm,height=3cm]{dummy}%
\label{fig:myfig_b}%
}
~
\subfigure[\tparbox{2.5cm}{justification becomes ugly sometimes}]{
\includegraphics[draft,width=3cm,height=3cm]{dummy}%
\label{fig:myfig_c}%
}
~
\subfigure[\tparbox{2.5cm}{there should be a way of applying \textbackslash raggedright or a similar command}]{
\includegraphics[draft,width=3cm,height=3cm]{dummy}%
\label{fig:myfig_d}%
}
\caption{Figure example}%
\label{fig:myfig}
\end{center}
\end{figure}
\end{document}