无法在 l4dc2023 模板中使用子图

无法在 l4dc2023 模板中使用子图

我正在使用来自https://l4dc.seas.upenn.edu/wp-content/uploads/2022/11/l4dc_2023.zip但在这里我不能用\subfigure。最小工作示例(通过更改l4dc2023-sample.texzip 文件中的文件)是

\documentclass[12pt]{l4dc2023}

% The following packages will be automatically loaded:
% amsmath, amssymb, natbib, graphicx, url, algorithm2e

\title[Short Title]{Full Title of Article}
\usepackage{times}

% Authors with different addresses:
\author{%
 \Name{Author Name1} \Email{[email protected]}\\
 \addr Address 1
 \AND
 \Name{Author Name2} \Email{[email protected]}\\
 \addr Address 2%
}

\begin{document}

\maketitle

\begin{abstract}%
 An abstract would go here.%
\end{abstract}

\begin{keywords}%
  List of keywords%
\end{keywords}

\section{Introduction}

%%%%%%%%%%%%%%% EXAMPLE 1 %%%%%%%%%%%%%%% 
\begin{figure}[!htbp]
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=0.35\textwidth]{example-image-a} \hfill
\caption{Example A}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=0.35\textwidth]{example-image-b} \hfill
\caption{Example B}
\end{subfigure}
\caption{Two Examples Visualization}
\end{figure}

\bibliography{yourbibfile}

\end{document}

但是,如果你改成\documentclass[12pt]{l4dc2023}\documentclass{article}注释掉\title[Short Title]{Full Title of Article},再添加\usepackage{subcaption},它就可以正常工作了。我仍然需要在这个模板下编写,所以我想知道是否有任何解决方法。我不明白他们在样式文件中定义了什么,希望有人也能向我解释一下。谢谢!

答案1

该类与不兼容subcaption,并且通过jmlrutils.sty它定义自己的\subfigure命令。

\documentclass[12pt]{l4dc2023}

% The following packages will be automatically loaded:
% amsmath, amssymb, natbib, graphicx, url, algorithm2e

\title[Short Title]{Full Title of Article}
\usepackage{newtxtext,newtxmath}

% Authors with different addresses:
\author{%
 \Name{Author Name1} \Email{[email protected]}\\
 \addr Address 1
 \AND
 \Name{Author Name2} \Email{[email protected]}\\
 \addr Address 2
}

\begin{document}

\maketitle

\begin{abstract}
An abstract would go here.
\end{abstract}

\begin{keywords}
  List of keywords
\end{keywords}

\section{Introduction}

%%%%%%%%%%%%%%% EXAMPLE 1 %%%%%%%%%%%%%%% 

\begin{figure}[!htbp]
\centering

\subfigure[Example A]{\includegraphics[width=0.35\textwidth]{example-image-a}}
\subfigure[Example B]{\includegraphics[width=0.35\textwidth]{example-image-b}}

\caption{Two Examples Visualization}
\end{figure}

\end{document}

在此处输入图片描述

相关内容