如何删除“重复”标签和箱号:“箱 1.1”?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tcolorbox}
\tcbuselibrary{most}
\usepackage[lf,sfdefault]{FiraSans}
\newtcolorbox[auto counter,number within=section,list inside=mybox]{mybox}[2][]{%
enhanced,
title={Box~\thetcbcounter:~#2},
#1,
halign title=center,
sharp corners,
fonttitle=\bfseries\sffamily\large,coltitle=black,titlerule=0pt,
colbacktitle=lightgray,
%colback=white,
drop fuzzy shadow
}
\begin{document}
\tcblistof[\section*]{mybox}{List of boxes}
\section{Blá blá}
\begin{mybox}{A mybox}
That's it.
\end{mybox}
\end{document}
答案1
为了从盒子列表中删除“Box 1.1:”并且只保留“1.1 A mybox”,您可以使用list text={#2}
命令\newtcolorbox
。
另一方面,如果您更喜欢将术语“Box”保留在盒子列表中,那么您可能希望使用list entry
如下面的示例所示的方式。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tcolorbox}
\tcbuselibrary{most}
\usepackage[lf,sfdefault]{FiraSans}
\newtcolorbox[auto counter,number within=section,list inside=mybox]{mybox}[2][]{%
enhanced,
title={Box~\thetcbcounter:~#2},
% list text={#2}, %<----- Comment in for "1.1 A mybox"
% list entry={\protect\numberline{\thetcbcounter}#2}, % <----- Comment in for "Box 1.1 A mybox".
#1,
halign title=center,
sharp corners,
fonttitle=\bfseries\sffamily\large,coltitle=black,titlerule=0pt,
colbacktitle=lightgray,
%colback=white,
drop fuzzy shadow
}
\begin{document}
\tcblistof[\section*]{mybox}{List of boxes}
\section{Blá blá}
\begin{mybox}{A mybox}
That's it.
\end{mybox}
\end{document}