はじめに
この記事では、subcaptionというLaTeXのpackageのPackage documentationを読みます。
そこにあった一部の例を列挙することにします。
前提
新しいバージョンのPackageでは、captionパッケージをロードする必要はありません。
もしロードが必要なら、必ずsubcaptionパッケージの前にロードする必要があります。
captionパッケージへのオプションは、\captionsetup
コマンドで可能だと思います。まだ確かめていない
Starting with version 1.4 the subcaption package requires at least version 3.1 of the caption package and loads it automatically. (Older versions of the subcaption package have required exactly the version of the caption package which was released with it.) If you need to use a specific version of the caption package you need to load it before the subcaption package
subcaptionboxを用いる
\begin{figure}
\centering
\subcaptionbox{A cat\label{cat}}[.4\textwidth]{\includegraphics{cat}}
\subcaptionbox{An elephant\label{elephant}}[.4\textwidth]{\includegraphics{elephant}}
\caption{Two animals}\label{animals}
\end{figure}
captionboxを用いる
\begin{figure}
\centering
\captionbox{A cat\label{cat}}
[.4\textwidth]{\includegraphics{cat}}%
\captionbox{An elephant\label{elephant}}
[.4\textwidth]{\includegraphics{elephant}}
\end{figure}
subcaptionblockを用いる
こっちは、TeXLive 2022以降を使っているユーザ向けになります。
\begin{figure}
\centering
\begin{subcaptionblock}{.4\textwidth}
\centering
\includegraphics{cat}
\caption{A cat}\label{cat}
\end{subcaptionblock}%
\begin{subcaptionblock}{.4\textwidth}
\centering
\includegraphics{elephant}
\caption{An elephant}\label{elephant}
\end{subcaptionblock}%
\caption{Two animals}\label{animals}
\end{figure}