
클래스를 사용하여 하위 그림이 있는 그림을 넣으려고 합니다 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}
어디에서나 명시적으로 하위 그림 환경을 사용할 필요가 없습니다.