subcaption subfig 包不工作

subcaption subfig 包不工作

我使用 ACM ACR 2 列乳胶模板https://www.sigapp.org/acr.html 我尝试放置四个带有字幕/子标题的图形,但它在我的模板中不起作用,我认为我的模板不支持子标题子图包。现在它显示的不是 a、b、c、d,而是图 10、11、12、13。请帮助 .cls 文件

\RequirePackage{comment}
\RequirePackage{algorithm}
\RequirePackage{algpseudocode}
\RequirePackage{graphicx}
\RequirePackage{booktabs}
\RequirePackage{makecell}
\RequirePackage{tabularx}
\RequirePackage{subcaption}
\RequirePackage{caption}
\RequirePackage{subcaption}

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}
\begin{figure*}[ht] % Use figure* to span both columns

  \begin{minipage}{0.45\textwidth}
    \centering
    \includegraphics[width=\textwidth]{example-image-a}
    \caption{Image A}
  \end{minipage}
  \hfill
  \begin{minipage}{0.45\textwidth}
    \centering
    \includegraphics[width=\textwidth]{example-image-b}
    \caption{Image B} 
  \end{minipage} 
  
  \begin{minipage}{0.45\textwidth} 
    \centering
    \includegraphics[width=\textwidth]{example-image-c} 
    \caption{Image C} 
  \end{minipage}  
  \hfill 
  \begin{minipage}{0.45\textwidth} 
    \centering
    \includegraphics[width=\textwidth]{example-image-a} 
    \caption{Image A again} 
  \end{minipage}
  \caption{Wow! Look at all those images!}
\end{figure*}
\end{document}

在此处输入图片描述

答案1

sample-sigplan.tex此示例基于LaTeX 的官方 ACM Primary 文章模板 [2023/03/30 v1.90 为计算机协会排版文章] 仅subcaption添加了包。

b

% !TeX TS-program = pdflatex

\documentclass[sigplan]{acmart}

\usepackage{subcaption} % added <<<<<<<<<<<<<<<<<<<<<

\usepackage{kantlipsum}% ONLY dummy tex

\setcopyright{acmcopyright}
\copyrightyear{2023}
\acmYear{2023}
\acmDOI{XXXXXXX.XXXXXXX}
    
\begin{document}

\title{The Name of the Title Is Hope}

\author{Ben Trovato}
\authornote{Both authors contributed equally to this research.}
\email{[email protected]}
\orcid{1234-5678-9012}
\author{G.K.M. Tobin}
\authornotemark[1]
\email{[email protected]}
\affiliation{%
  \institution{Institute for Clarity in Documentation}
  \streetaddress{P.O. Box 1212}
  \city{Dublin}
  \state{Ohio}
  \country{USA}
  \postcode{43017-6221}
}

\begin{abstract}
 \kant[1]
\end{abstract}

\maketitle

\section{Introduction}
\kant[2-3]

\section{Template Overview}
\kant[4]

\subsection{Template Styles}

Journals use one of three template styles. All but three ACM journals
use the {\verb|acmsmall|} template style:
\begin{itemize}
\item {\texttt{acmsmall}}: The default journal template style.
\item {\texttt{acmlarge}}: Used by JOCCH and TAP.
\item {\texttt{acmtog}}: Used by TOG.
\end{itemize}

The majority of conference proceedings documentation will use the {\verb|acmconf|} template style.
\begin{itemize}
\item {\texttt{acmconf}}: The default proceedings template style.
\item{\texttt{sigchi}}: Used for SIGCHI conference articles.
\item{\texttt{sigplan}}: Used for SIGPLAN conference articles.
\end{itemize}

\section{Figures}

Your figures should contain a caption which describes the figure to
the reader.

Figure captions are placed {\itshape below} the figure.
    
\begin{figure}[ht]
    \begin{subfigure}[t]{0.45\linewidth}
        \includegraphics[width=\linewidth]{example-image-a}
        \caption{Image A}\label{img:a}
    \end{subfigure}
    \hfill
    \begin{subfigure}[t]{0.45\linewidth}
        \includegraphics[width=\linewidth]{example-image-b}
        \caption{Image B}\label{img:b}
    \end{subfigure}\bigskip

    \begin{subfigure}[t]{0.45\linewidth}
        \includegraphics[width=\linewidth]{example-image-c}
        \caption{Image C}\label{img:c}
    \end{subfigure}
    \hfill
    \begin{subfigure}[t]{0.45\linewidth}
        \includegraphics[width=\linewidth]{example-image-a}
        \caption{Image A again}\label{img:d}
    \end{subfigure}
    \caption{Wow! Look at all those images!}    \label{img:abcd}
\end{figure}

Every figure should also have a figure description unless it is purely
decorative. These descriptions convey what’s in the image to someone
who cannot see it. They are also used by search engine crawlers for
indexing images, and when images cannot be loaded.

A figure description must be unformatted plain text less than 2000
characters long (including spaces).  {\bfseries Figure descriptions
  should not repeat the figure caption – their purpose is to capture
  important information that is not already provided in the caption or
  the main text of the paper.} For figures that convey important and
complex new information, a short text description may not be
adequate. More complex alternative descriptions can be placed in an
appendix and referenced in a short figure description.

\section{Research Methods}

\subsection{Part One}

\kant[2-3]

\subsection{Part Two}

\kant[4]

\end{document}

相关内容