“数字自由式”导致 tcolorboxes 列表中出现覆盖

“数字自由式”导致 tcolorboxes 列表中出现覆盖

这是Cref 还能提供 tcolorbox 的标题吗?因为答案“使用选项将标题添加为数字的一部分number freestyle”似乎在list of tcolorboxes

  • 覆盖层,
  • 双重编号。

在此处输入图片描述

以下是代码:

 \documentclass{book}

\usepackage{cleveref}
\usepackage{tcolorbox}
        \tcbuselibrary{skins,}  

\newcounter{thm}%[chapter] 
\newtcolorbox%
[%
use counter= thm,
number within=chapter,
number freestyle={\noexpand\thechapter.\noexpand\arabic{\tcbcounter}~\noexpand\mytitle},%
list inside= thm,%creates the list under tcblistof
crefname={Theorem}{Theorems},
Crefname={Theorem}{Theorems},
]%
{heorem}%
[2][]%
{%
detach title,%
before upper={\tcbtitle\quad},%
arc=0.2mm,%
colback=green!5,%
colframe=green!35!black,%
fonttitle=\bfseries,%
coltitle=black,%
code={\def\mytitle{#2}},%
title=THEOREM \thetcbcounter,%
#1%
}%

\begin{document}
\chapter{ONE}
\section{one}
\begin{heorem}[label={thm:1-1}]{Continuity}\hspace{-4mm}
Necessary for a good storyline.
\end{heorem}


See \cref{thm:1-1}

\tcblistof[\chapter]{thm}{List of Theorems}

\end{document}

答案1

使用list entry选项覆盖默认title=条目List of...

 \documentclass{book}

\usepackage{cleveref}
\usepackage{tcolorbox}
\tcbuselibrary{skins,}  

\newcounter{thm}%[chapter] 
\newtcolorbox%
[%
use counter= thm,
number within=chapter,
number freestyle={\noexpand\thechapter.\noexpand\arabic{\tcbcounter}~\noexpand\mytitle},
list inside= thm,%creates the list under tcblistof
list type=heorem,
crefname={Theorem}{Theorems},
Crefname={Theorem}{Theorems},
]%
{heorem}%
[2][]%
{%
detach title,%
before upper={\tcbtitle\quad},%
arc=0.2mm,%
colback=green!5,%
colframe=green!35!black,%
fonttitle=\bfseries,%
coltitle=black,%
code={\gdef\mytitle{#2}},
title={THEOREM \thetcbcounter},%
list entry={THEOREM~\thetcbcounter},
#1%
}%

\makeatletter
\newcommand*\l@heorem{\@dottedtocline{1}{1.5em}{2.3em}} % For customization of the spacings
\makeatother

\begin{document}
\chapter{ONE}
\section{one}
\begin{heorem}[label={thm:1-1}]{Continuity}\hspace{-4mm}
Necessary for a good storyline.
\end{heorem}


See \cref{thm:1-1}

\tcblistof[\chapter]{thm}{List of Theorems}

\end{document}

在此处输入图片描述

在此处输入图片描述

答案2

这是一个解决方案。我们需要重新定义两个命令

{
\renewcommand*\numberline[1]{}
\makeatletter
\renewcommand{\l@tcolorbox}{\@dottedtocline{-1}{0pt}{-2.3em}}
\tcblistof[\chapter]{thm}{List of Theorems}
}

平均能量损失

\documentclass{book}

\usepackage{cleveref}
\usepackage{tcolorbox}
        \tcbuselibrary{skins,}  

\newcounter{thm}%[chapter] 
\newtcolorbox%
[%
use counter= thm,
number within=chapter,
number freestyle={\noexpand\thechapter.\noexpand\arabic{\tcbcounter}~\noexpand\mytitle},%
list inside= thm,%creates the list under tcblistof
crefname={Theorem}{Theorems},
Crefname={Theorem}{Theorems},
]%
{heorem}%
[2][]%
{%
detach title,%
before upper={\tcbtitle\quad},%
arc=0.2mm,%
colback=green!5,%
colframe=green!35!black,%
fonttitle=\bfseries,%
coltitle=black,%
code={\def\mytitle{#2}},%
title=THEOREM \thetcbcounter,%
#1%
}%

\begin{document}
\chapter{ONE}
\section{one}
\begin{heorem}[label={thm:1-1}]{Continuity}\hspace{-4mm}
Necessary for a good storyline.
\end{heorem}


See \cref{thm:1-1}

{
\renewcommand*\numberline[1]{}
\makeatletter
\renewcommand{\l@tcolorbox}{\@dottedtocline{-1}{0pt}{-2.3em}}
\tcblistof[\chapter]{thm}{List of Theorems}
}

\end{document}

相关内容