![交叉引用定理时,只显示章节和节的编号](https://linux22.com/image/465820/%E4%BA%A4%E5%8F%89%E5%BC%95%E7%94%A8%E5%AE%9A%E7%90%86%E6%97%B6%EF%BC%8C%E5%8F%AA%E6%98%BE%E7%A4%BA%E7%AB%A0%E8%8A%82%E5%92%8C%E8%8A%82%E7%9A%84%E7%BC%96%E5%8F%B7.png)
当我交叉引用一个定理时,为什么只出现章节和章节的编号?
\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}