如何让重述的 tcolorbox 出现在 tcolorboxes 列表中

如何让重述的 tcolorbox 出现在 tcolorboxes 列表中

正在重述定义。MWE 在定义列表中列出了原始版本。我希望重述版本也出现。(如果列表条目相同,则没问题。)

\documentclass[11pt]{book}
\usepackage{tcolorbox}%---This is where the PACKAGE must be.
\tcbuselibrary{%Begin load libraries for tcolorbox  
        skins,%
            }%End load libraries for tcolorbox      
\usepackage[hyperfootnotes=false]{hyperref}%[pdfborder={0 0 0}] 
\usepackage{cleveref}
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Begin new tcolorbox - COMMANDS must be after cleveref.
\newcounter{dft}%
\newtcolorbox%
[%beginForReferences
use counter= dft,
number within=chapter,
list inside= dft,%creates the list under tcblistof
crefname={definition}{definitions},
Crefname={Definition}{Definitions},
]%endForReferences
{efinition}%
[2][]%
{%
detach title,
coltitle=black,
nameref={#2},%
before upper={\tcbtitle\quad},%
code={\gdef\mytitleagree{\textbf{#2}}},%%Used to include mytitle in the ``number''
title=DEFINITION \thetcbcounter \, #2,%
nameref=#2,%
list entry={DEFINITION ~\thetcbcounter ~ #2},%
#1,%Required for references.
}%
%=======Begin To restate an already stated definition STURM after YASMAR
\newtcolorbox%
{efinitionRphr}%
[3][]%
{%
detach title,%This prevents the top from being the color of the frame
before upper={\tcbtitle\quad},%This prevents the top from being the color of the frame
enhanced,%
arc=0.2mm,%
colback= yellow,%
colframe= black,%
coltitle=black,%
title= DEFINITION ~\ref{#2}~\nameref{#2},%
list entry={Definition~\thetcbcounter},
#1%
}%
%=======End To restate an already stated definition STURM after YASMAR
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ End new tcolorbox
\begin{document}
\chapter{Original}
 \begin{efinition}[label={dft:1-1}]{Maximum}
  An input whose output is larger than the outputs for nearby inputs
\end{efinition}
\chapter{Restated}
\begin{efinitionRphr}[label={dft:1-1a}]{dft:1-1}{~}
The biggest of all
\end{efinitionRphr}
\tcblistof[\chapter]{dft}{List of Definitions}
\end{document}    

在此处输入图片描述

答案1

为了满足你的习惯tcolorbox出现在定义列表,你必须引用它。这是经过一些更改后的代码

\newtcolorbox[%
            use counter= dft,
            number within=chapter,
            list inside= dft,
            crefname={definition}{definitions}
]
    {efinitionRphr}
            [2][] {%
            detach title,
            before upper={\tcbtitle\quad},
            enhanced,
            nameref={#2},
            arc=0.2mm,
            colback= yellow,
            colframe= black,
            coltitle=black,
            title=DEFINITION~\ref{#2}~\nameref{#2},
            list entry={DEFINITION~\ref{#2}~\nameref{#2}},
            #1%
    }

请注意,你的参数数量tcb现在只有 2,因此已重启盒子必须像这样改变

\chapter{Restated}
\begin{efinitionRphr}[label={dft:1-1a}]{dft:1-1}
    The biggest of all
\end{efinitionRphr}

在此处输入图片描述

相关内容