새로운 하위 플로트를 만드는 방법은 무엇입니까?

새로운 하위 플로트를 만드는 방법은 무엇입니까?

를 사용하면 \newfloat새로운 부동 환경을 생성할 수 있으며 다음 예시와 같습니다.이것게시물에서라는 새 부동 소수점을 만들었지 suppfig만 그 안에 하위 그림을 추가하고 싶습니다. 그 안에 하위 그림을 추가하면 다음과 같은 메시지가 나타납니다.

정의된 카운터가 없습니다 subsuppfig.

subsuppfig라는 카운터를 추가하면 \newcounter{subsuppfig}다음과 같은 결과가 나타납니다.

측정 단위가 잘못되었습니다(pt 삽입).

새로운 subfloat 환경을 어떻게 정의합니까?


암호:

\documentclass{article}
\usepackage{float,subcaption,graphicx}

\begin{document}

\newfloat{suppfig}{tbh}{supp}
\floatname{suppfig}{Supplementary Figure}
\begin{suppfig}[H]
  \centering
  \begin{subfigure}{\textwidth}
    \centering
    \caption{ }
    \includegraphics[width=\textwidth]{example-image-a}
  \end{subfigure}

  \begin{subfigure}{\textwidth}
    \centering
    \caption{ }
    \includegraphics[width=\textwidth]{example-image-b}
  \end{subfigure}
  \caption{...figurecaptions...}
\end{suppfig}
\end{document}

답변1

newfloat친구들 과 잘 작동하도록 설계된 패키지인 package 를 사용하세요 caption.

\documentclass{article}
\usepackage{newfloat}
\usepackage{subcaption}
\DeclareFloatingEnvironment[name={Supplementary Figure}]{suppfigure}
\begin{document}
\begin{suppfigure}
    \begin{subsuppfigure}{.45\textwidth}
        \centering\rule{.9\linewidth}{2cm}
    \caption{a small supplementary figure}
\end{subsuppfigure}\hfill%
    \begin{subsuppfigure}{.45\textwidth}
        \centering\rule{.9\linewidth}{2cm}
    \caption{another small supplementary figure}
\end{subsuppfigure}
\caption{And a captin for all of them}
\end{suppfigure}
\end{document}

답변2

subcaption사용할 때 (자동화된 방식으로) 잘 작동합니다.newfloat플로트 생성을 위해. 그러나 사용 중인 경우float또는floatrow, 당신은 스스로 발품 작업을 해야 할 것입니다.

다음은subcaption선적 서류 비치(부분5 \DeclareCaptionSubType명령):

패키지 의 하위 캡션 기능을 사용하려면 caption몇 가지 명령과 카운터를 준비해야 합니다. 이 작업은 다음과 같이 수행됩니다.

\DeclareCaptionSubType[<numbering scheme>]{<type>}
\DeclareCaptionSubType*[<numbering scheme>]{<type>}

환경 figure& 및 패키지 에서 제공 table으로 정의된 모든 환경 의 경우 이 작업이 자동으로 수행되지만 다른 환경(예: 패키지 에서 제공 으로 정의되거나 패키지 에서 제공되는 환경 )의 경우 수동으로 수행되어야 합니다.\DeclareFloatingEnvironmentnewfloat\newfloatfloat\DeclareNewFloatTypefloatrow

여기에 이미지 설명을 입력하세요

\documentclass{article}
\usepackage{float,graphicx,subcaption}


\newfloat{suppfig}{tbh}{supp}
\floatname{suppfig}{Supplementary Figure}
\DeclareCaptionSubType{suppfig}
\renewcommand{\thesubsuppfig}{\Alph{subsuppfig}}

\begin{document}

\begin{suppfig}[H]
  \centering
  \begin{subfigure}{\textwidth}
    \centering
    \caption{First subcaption}
    \includegraphics[width=.6\linewidth]{example-image-a}
  \end{subfigure}

  \begin{subfigure}{\textwidth}
    \centering
    \caption{Second subcaption}
    \includegraphics[width=.6\linewidth]{example-image-b}
  \end{subfigure}
  \caption{Figure caption}
\end{suppfig}

\end{document}

관련 정보