我想使用子图包,因为它允许根据列宽等定义子图环境大小。但是,我需要遵循一些格式:
- 图形标题位于顶部并左对齐(图 1 - ...);
- 子图下方的子标题和
- 图形描述位于底部并左对齐。
这怎么可能?提前致谢
已更新:我几乎已经得到了我需要的东西。只有对子图的引用还不正确。
\documentclass{article}
\usepackage{mwe}
\newcounter{subfig}[figure]
\renewcommand{\thesubfig}{\alph{subfig}}
\newcommand{\subcaption}[1]% #1 = caption text
{\par\stepcounter{subfig}%
\makebox[\textwidth]{\textbf{(\thesubfig)} #1}%
\medskip\par}
\newenvironment{subfigure}[1]% width
{\begin{minipage}{#1}\let\caption=\subcaption}%
{\end{minipage}}
\usepackage[justification=justified,singlelinecheck=false,labelsep=endash,position=top]{caption}
\begin{document}
\begin{figure}[t]
\caption{Test 1}
\begin{subfigure}{0.45\columnwidth}
\centering\includegraphics[width=\textwidth]{example-image-a}%
\label{fig:test11}
\caption{}
\end{subfigure}\hfill
\begin{subfigure}{0.45\columnwidth}
\centering\includegraphics[width=\textwidth]{example-image-b}%
\label{fig:test12}
\caption{}
\end{subfigure}
\label{fig:test1}\\
{\footnotesize Source: Here comes the figures description.}
\end{figure}
\begin{figure}[!h]
\caption{Test 2}
\begin{center}
\centering\includegraphics[width=0.6\columnwidth]{example-image-c}
\end{center}
\label{fig:test2}
{\footnotesize Source: Here comes the figures description.}
\end{figure}
Figures \ref{fig:test1} is composed of \ref{fig:test11} e \ref{fig:test12}.
Figure \ref{fig:test2} is an ordinary include entry.
\end{document}
这里是输出:
答案1
看看你的 MWE 的这个修改是否符合你的要求:
\documentclass{article}
\usepackage{mwe}
\usepackage[justification=justified,
singlelinecheck=false,
labelsep=endash,
position=top]{caption}
\usepackage[justification=centering]{subcaption}
\begin{document}
\begin{figure}[t]
\caption{Test 1}
\label{fig:test1}
\begin{subfigure}{0.45\columnwidth}
\centering
\includegraphics[width=\linewidth]{example-image-a}%
\caption{}
\label{fig:test11}
\end{subfigure}
\hfill
\begin{subfigure}{0.45\columnwidth}
\centering
\includegraphics[width=\linewidth]{example-image-b}%
\caption{}
\label{fig:test12}
\end{subfigure}
{\footnotesize Source: Here comes the figures description.}
\end{figure}
\begin{figure}[!h]
\centering
\caption{Test 2}
\label{fig:test2}
\includegraphics[width=0.6\columnwidth]{example-image-c}
\begin{minipage}{\linewidth}\footnotesize
Source: Here comes the figures description.
\end{minipage}
\end{figure}
Figures \ref{fig:test1} is composed of \ref{fig:test11} e \ref{fig:test12}.
Figure \ref{fig:test2} is an ordinary include entry.
\end{document}
在上面的 MWE 中,我删除了子图计数器和环境的定义,而是使用包subcaption
。除此之外,我在标题后面放置了标签,放在它们应该在的位置(以便正确引用)