
クラスを使用して、サブ図を含む図を配置しようとしていますacmsmall
。コンパイル時に次のエラーが発生します。
Package caption Warning: Unsupported document class (or package) detected, (caption)
usage of the caption package is not recommended. See the caption package documentation for explanation.
) (/usr/local/texlive/2012/texmf-dist/tex/latex/caption/subcaption.sty
! LaTeX Error: Command \subcaption already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help. ...
l.57 \caption@gobble}}
%
?
スキップすると、別のエラーが表示されます。
Package caption Warning: \caption will not be redefined since it's already
(caption) redefined by a document class or package which is
(caption) unknown to the caption package.
See the caption package documentation for explanation.
! Package caption Error: The `subcaption' package does not work correctly
(caption) in compatibility mode.
See the caption package documentation for explanation.
Type H <return> for immediate help.
...
l.7 \begin{document}
?
続行すると、図は正常に表示されますが、何が起こっているのかを知りたいです。他のドキュメント クラス (IEEEtran など) でサブ図を挿入する際に問題が発生したことはありません。
MWE は次のとおりです。
\documentclass[prodmode,acmtecs]{acmsmall}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\begin{document}
\begin{figure}
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics{acmsmall-mouse.pdf}
\caption{A subfigure}
\end{subfigure}%
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics{acmsmall-mouse.pdf}
\caption{Another subfigure}
\end{subfigure}%
\caption{Several figures}
\end{figure}
\end{document}
サブフィギュアを作成するための推奨される方法はありますかacmsmall
?
答え1
acsmall.cls
ここからダウンロードした画像を使用しました:http://www.acm.org/publications/latex_style/v2-acmsmall.zip
クラスはコマンドacmsmall
を定義するので、目的に応じて sの代わりに s\subcaption
を使用できます。minipage
subfigure
MWE:
\documentclass[prodmode,acmtecs]{acmsmall}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\begin{minipage}[b]{0.5\textwidth}
\includegraphics{acmsmall-mouse.pdf}\\
\subcaption{A subfigure}
\end{minipage}%
\begin{minipage}[b]{0.5\textwidth}
\includegraphics{acmsmall-mouse.pdf}\\
\subcaption{Another subfigure}
\end{minipage}%
\caption{Several figures}
\end{figure}
\end{document}
出力:
答え2
クラスは、Karlの回答に示されているキャプションを生成するacmsmall
コマンドを定義しています。そのテンプレートに厳密に縛られず、パッケージ のような通常のラベル付けを使用したい場合は、そのコマンドを未定義にする必要があります。そうする理由は、質問されているように、いくつかの( )を参照したい場合です。\subcaption
subcaption
subfigure
\ref{fig:a}
ここ。
次のようになります。
% arara: pdflatex
\documentclass[prodmode,acmtecs]{acmsmall}
\let\subcaption\relax
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{hyperref}
\begin{document}
\begin{figure}
\begin{subfigure}[b]{0.49\textwidth}
\includegraphics{acmsmall-mouse.pdf}
\subcaption{A subfigure}\label{fig:a}
\end{subfigure}
\begin{subfigure}[b]{0.49\textwidth}
\includegraphics{acmsmall-mouse.pdf}
\subcaption{Another subfigure}\label{fig:b}
\end{subfigure}
\caption{Several figures}\label{fig:1}
\end{figure}
\end{document}
これは、そのテンプレートを提供したエディターの考えではないことに注意してください。このように調整する前に、同じエディターに相談してください。番号付きのサブキャプションは、全体のデザインに合わないかもしれません。この場合、次のように参照する必要があります。as you can see in Figure~\ref{fig:1} (left pic.)
答え3
さて、LaRiFaRi からの回答にコメントすることはできないようですので、ここに書きます... LaRiFaRi からの回答はそのままでは機能しません。理由はわかりませんが、パッケージを追加することでのみ機能するようになりましたhyperref
。コードは次のとおりです。
\documentclass[prodmode,acmtecs]{acmsmall}
\let\subcaption\relax
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{hyperref} %WHY is that ?
\begin{document}
\begin{figure}
\begin{subfigure}[b]{0.49\textwidth}
\includegraphics{acmsmall-mouse.pdf}
\subcaption{A subfigure}\label{fig:a}
\end{subfigure}
\begin{subfigure}[b]{0.49\textwidth}
\includegraphics{acmsmall-mouse.pdf}
\subcaption{Another subfigure}\label{fig:b}
\end{subfigure}
\caption{Several figures}\label{fig:1}
\end{figure}
\end{document}
結果の画像は次のようになります。
答え4
hyperref
含めることにはもう一つの効果があることがわかりました。
\begin{minipage}
...
\subcaption{...}
...
\end{minipage}
明示的にサブフィギュア環境を使用する必要はありません。