当我交叉引用一个定理时,为什么只出现章节和章节的编号?
\documentclass[x11names,oneside,12pt]{book}
\usepackage{tcolorbox}
\tcbuselibrary{theorems,breakable}
\newtcbtheorem[number within=section]{thm}{Theorem}{
before skip=10pt, breakable, detach title,
leftrule=2mm, before upper={\tcbtitle\quad},
coltitle=black, colback=black!3!white,
colframe=black!10!white, fonttitle=\bfseries,
arc=0mm, separator sign none,
description delimiters parenthesis,
terminator sign colon}{theo}
\begin{document}
\chapter{First Chapter}
\section{First Section}
\begin{thm}{}{}\label{thm}
Statement.
\end{thm}
In Theorem \ref{thm}\dots
\end{document}
答案1
当使用借助于彩色盒子包中,你必须更换
\begin{thm}{}{}\label{thm}
和
\begin{thm}[label=thm]{}{}
在用户指南的第 4.21 节“计数器、标签和引用”中对此进行了详细的解释(甚至可能过于详细……)。彩色盒子包裹。
\documentclass[x11names,oneside,12pt]{book}
\usepackage{tcolorbox}
\tcbuselibrary{theorems,breakable}
\newtcbtheorem[number within=section]{thm}{Theorem}{
before skip=10pt, breakable, detach title,
leftrule=2mm, before upper={\tcbtitle\quad},
coltitle=black, colback=black!3!white,
colframe=black!10!white, fonttitle=\bfseries,
arc=0mm, separator sign none,
description delimiters parenthesis,
terminator sign colon}{theo}
\begin{document}
\chapter{First Chapter}
\section{First Section}
%%\begin{thm}{}{}\label{thm} % <-- wrong
\begin{thm}[label=thm]{}{} % <-- right
Statement.
\end{thm}
In Theorem \ref{thm}, \dots
\end{document}