我正在使用 ACM 两列模板来制作日记。之前,当我使用单列模板时,我能够以全横向显示图片(2 行 4 列),因此使用以下代码可以显示顶部 4 个图片和底部 4 个图片。现在,转到带有 2 列日记模板的新模板,相同的代码会垂直呈现所有图片,因此所有 8 个图片都垂直堆叠在其中一个文本列中。
\usepackage{subcaption}
\usepackage[flushleft]{threeparttable} % <---
\usepackage{dcolumn}
\captionsetup[subfigure]{justification=raggedright}
\begin{figure}
\centering
\subcaptionbox{Iteration 1\label{sfig:a}}{\includegraphics[width=.25\textwidth,height=2cm]{fig1.png}}\hfill
\subcaptionbox{Iteration 2\label{sfig:b}}{\includegraphics[width=.25\textwidth,height=2cm]{fig2.png}}\hfill
\subcaptionbox{Iteration 3\label{sfig:c}}{\includegraphics[width=.25\textwidth,height=2cm]{fig3.png}}\hfill
\subcaptionbox{Iteration 4\label{sfig:d}}{\includegraphics[width=.25\textwidth,height=2cm]{fig4.png}}\\
\subcaptionbox{Iteration 5\label{sfig:e}}{\includegraphics[width=.25\textwidth,height=2cm]{fig5.png}}\hfill
\subcaptionbox{Iteration 6\label{sfig:f}}{\includegraphics[width=.25\textwidth,height=2cm]{fig6.png}}\hfill
\subcaptionbox{Iteration 7\label{sfig:g}}{\includegraphics[width=.25\textwidth,height=2cm]{fig7.png}}\hfill
\subcaptionbox{Iteration 8\label{sfig:g}}{\includegraphics[width=.25\textwidth,height=2cm]{fig8.png}}\hfill
\caption{Captain of the figure}
\label{fig:test}
\end{figure}
以下是我想要的最终结果:
答案1
像这样
\documentclass[sigchi]{acmart}
\usepackage{subcaption}
\begin{document}
\title{Title}
\author{author 1}
\begin{abstract}
The abstract is a short summary of the work to be presented in the article.
\end{abstract}
\maketitle
\begin{figure*}[h]
\centering
\begin{subfigure}{0.24\textwidth}
\includegraphics[width=\textwidth]{example-image-a}
\subcaption{The 1907 Franklin Model D roadster.}
\end{subfigure}
% <— this is important. There should be no empty line here.
\begin{subfigure}{0.24\textwidth}
\includegraphics[width=\textwidth]{example-image-b}
\subcaption{The 1907 Franklin Model D roadster.}
\end{subfigure}
%
\begin{subfigure}{0.24\textwidth}
\includegraphics[width=\textwidth]{example-image-c}
\subcaption{The 1907 Franklin Model D roadster.}
\end{subfigure}
%
\begin{subfigure}{0.24\textwidth}
\includegraphics[width=\textwidth]{example-image-a}
\subcaption{The 1907 Franklin Model D roadster.}
\end{subfigure}\\
\begin{subfigure}{0.24\textwidth}
\includegraphics[width=\textwidth]{example-image-a}
\subcaption{The 1907 Franklin Model D roadster.}
\end{subfigure}
% <— this is important. There should be no empty line here.
\begin{subfigure}{0.24\textwidth}
\includegraphics[width=\textwidth]{example-image-b}
\subcaption{The 1907 Franklin Model D roadster.}
\end{subfigure}
%
\begin{subfigure}{0.24\textwidth}
\includegraphics[width=\textwidth]{example-image-c}
\subcaption{The 1907 Franklin Model D roadster.}
\end{subfigure}
%
\begin{subfigure}{0.24\textwidth}
\includegraphics[width=\textwidth]{example-image-a}
\subcaption{The 1907 Franklin Model D roadster.}
\end{subfigure}
\end{figure*}
\end{document}
答案2
- 您的文档类别未知,因此我使用标准
article
选项twocolumn
- 添加了使用该
ragged2e
包的子图标题的格式 - 添加了
stfloats
包,如果有足够的空间,可以将图形放在同一页面的底部。定位应使用位置选项手动完成[b]
妇女权利委员会:
\documentclass[twocolumn]{article}
\usepackage{stfloats}
\usepackage{graphicx}
\usepackage{ragged2e}
\usepackage[justification=RaggedRight]{subcaption}
\usepackage{lipsum}
\title{Title}
\author{author 1}
\begin{document}
\maketitle
\begin{abstract}
The abstract is a short summary of the work to be presented in the article.
\end{abstract}
\section{Introduction}
\begin{figure*}[b]
\setkeys{Gin}{width=\linewidth}
\begin{subfigure}[t]{0.24\textwidth}
\includegraphics{example-image-a}
\caption{The 1907 Franklin Model D roadster.}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.24\textwidth}
\includegraphics{example-image-b}
\caption{The 1907 Franklin Model D roadster.}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.24\textwidth}
\includegraphics{example-image-c}
\caption{The 1907 Franklin Model D roadster.}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.24\textwidth}
\includegraphics[width=\textwidth]{example-image-duck}
\caption{The 1907 Franklin Model D roadster.}
\end{subfigure}
\medskip
\begin{subfigure}[t]{0.24\textwidth}
\includegraphics{example-image-a}
\caption{The 1907 Franklin Model D roadster.}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.24\textwidth}
\includegraphics{example-image-b}
\caption{The 1907 Franklin Model D roadster.}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.24\textwidth}
\includegraphics{example-image-c}
\caption{The 1907 Franklin Model D roadster.}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.24\textwidth}
\includegraphics{example-image-duck}
\caption{The 1907 Franklin Model D roadster.}
\end{subfigure}
\caption{Common caption}
\end{figure*}
\lipsum[1]
\end{document}