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

空のままにした定理環境の 2 番目の引数は、実際にはラベル用です。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}

関連情報