그림 환경 자연 문서 클래스 갱신

그림 환경 자연 문서 클래스 갱신

figure캡션이 가 Supplementary Figure아닌 것으로 원하기 때문에 환경 을 갱신하고 싶습니다 Figure. 나는 naturedocumentclass를 사용하고 있는데 코드 조각을 찾았습니다.

\renewenvironment{figure}{\let\caption\NAT@figcaption}{}
    
\newcommand{\NAT@figcaption}[2][]{\AtEndDocument{%
    \refstepcounter{figure}
    \ifthenelse{\value{figure}=1}{
        \newpage\noindent%
%        \rule{\textwidth}{1pt}
    }{
        \par\vfill
    }
    \sffamily\noindent\textbf{Figure \arabic{figure}}\hspace{1em}#2}
    }

에서 nature.cls. 내 생각은 코드를 포함하는 것이 었습니다

\renewenvironment{figure}{\let\caption\NAT@figcaption}{}
\renewcommand{\NAT@figcaption}[2][]{\AtEndDocument{%
    \refstepcounter{figure}
    \ifthenelse{\value{figure}=1}{
        \newpage\noindent%
%        \rule{\textwidth}{1pt}
    }{
        \par\vfill
    }
    \sffamily\noindent\textbf{Supplementary Figure \arabic{figure}}\hspace{1em}#2}
    }

내 문서에는 분명히 작동하지 않습니다. 특정 문서에 대해서만 그림 환경을 변경하는 방법이 있습니까?

답변1

귀하의 패치는 여기에서 잘 작동합니다:

\documentclass{nature}

\makeatletter
\renewcommand{\NAT@figcaption}[2][]{\AtEndDocument{%
    \refstepcounter{figure}
    \ifthenelse{\value{figure}=1}{
        \newpage\noindent%
%        \rule{\textwidth}{1pt}
    }{
        \par\vfill
    }
    \sffamily\noindent\textbf{Supplementary Figure \arabic{figure}}\hspace{1em}#2}
    }
\makeatother

\begin{document}
Some text
\begin{figure}
\caption{A figure}
\end{figure}
\end{document}

결과는 다음과 같습니다. "보조 그림 1 A 그림"

완전한 문서(MWE) 대신 코드 조각만 제공했기 때문에 무엇을 잘못했는지 말하기가 어렵습니다.

관련 정보