tcbtheorem 참조 번호 매기기

tcbtheorem 참조 번호 매기기

내 문서에서는 모든 정리 환경이 정의 1, 정의 2, ..., 정리 1, 정리 2, ...로 연속적으로 계산되도록 하고 싶습니다.

나는 이것을 수행하는 tcb 정리 환경을 만들었습니다. 그러나 정리를 참조할 때마다 정리가 속한 섹션 + 하위 섹션만 제공됩니다.

\documentclass[reqno, 11pt]{amsart}
\usepackage[margin=0.75in]{geometry}
\usepackage{tcolorbox}
\usepackage{hyperref}
\usepackage{nameref}
\tcbuselibrary{theorems}

\hypersetup{
    colorlinks = true,
    linkcolor={red!50!black}
}

\newtcbtheorem[auto counter]{thm}{Theorem}
{theorem style=plain,colframe=red!50!black,colback=red!5!white,
coltitle=red!50!black,fonttitle=\upshape\bfseries,fontupper=\itshape,boxrule=0.5pt}{}

\begin{document}
\section{First Section}
    \subsection{Subsection One} \hfill
        \begin{thm}{Theorem 1 Name}{} \label{thm:1}
            Theorem here
        \end{thm}
        \begin{thm}{Theorem 2 name}{} \label{thm:2}
            Theorem here 
        \end{thm}
By Theorem ~\ref{thm:1}, ... By Theorem ~\ref{thm:2},...
\end{document}

이 예에서 참조는 정리 1과 2 모두에 대해 1.1을 렌더링하고 싶습니다. 정리 1에 대해 1을 렌더링하고 정리 2에 대해 2를 렌더링하고 싶습니다. 분명히 다른 섹션으로 이동할 때 재설정되지 않았으면 좋겠습니다.

답변1

비워둔 정리 환경의 두 번째 인수는 실제로 레이블에 대한 것입니다. 정리 환경을 정의할 때 와 같이 접두사를 지정할 수 있으므로 thm(비워둔 마지막 인수) 모든 레이블에서 이를 반복할 필요가 없습니다.

\documentclass[reqno, 11pt]{amsart}
\usepackage[margin=0.75in]{geometry}
\usepackage{tcolorbox}
\usepackage{nameref}
\tcbuselibrary{theorems}
\usepackage{hyperref}
\hypersetup{
    colorlinks = true,
    linkcolor={red!50!black}
}

\newtcbtheorem[auto counter]{thm}{Theorem}
{theorem style=plain,colframe=red!50!black,colback=red!5!white,
coltitle=red!50!black,fonttitle=\upshape\bfseries,fontupper=\itshape,boxrule=0.5pt}{thm}

\begin{document}
\section{First Section}
    \subsection{Subsection One} \hfill
        \begin{thm}{Theorem 1 Name}{duck}
            Theorem here
        \end{thm}
        \begin{thm}{Theorem 2 name}{bear}
            Theorem here 
        \end{thm}
By Theorem ~\ref{thm:duck}, ... By Theorem ~\ref{thm:bear},...
\end{document}

관련 정보