我正在编写一个相当大的文档,并想制作一个使用过的框的目录。我使用 tcolorbox 包,因为我喜欢它让你自由修改框外观的方式。在使用包提供的选项生成目录时,我在目录中获得了额外的编号。我怀疑这是因为 tcblistof 生成了自己的编号,我也在框的标题中使用了它们。我想去掉这些数字。在 tcblistof 的标题前面。
这是一个提出问题的 MWE:
\documentclass[numbers=noenddot,12pt,footinput=true,headinput=true,cleardoublepage=empty,twoside,svgnames,colorlinks=true]{scrbook}
\usepackage{scrlfile}
\PreventPackageFromLoading{mathpazo}
\usepackage[parts,pdfspacing,manychapters,dottedtoc,drafting]{classicthesis}
%manychapters,eulerchapternumbers,eulermath,listings,linedheaders
\usepackage{lmodern}
\usepackage{textcomp}
\usepackage[T1]{fontenc}
\usepackage[outer=7cm, inner=1.5cm, marginparwidth=4.5cm,marginparsep=.6cm, textheight=674pt]{geometry}%showframe
\usepackage[dutch]{babel}
\usepackage{xspace}
\usepackage{tocbibind}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage[font=footnotesize,font=rm,labelfont={bf,rm},format=plain,style=default]{caption}
\usepackage{subcaption}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{float}
\usepackage[utf8]{inputenc}
\usepackage[framemethod=tikz]{mdframed}
\usepackage[most,listings]{tcolorbox}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{arsclassica}
\usepackage{threeparttable}
\usepackage{lipsum}
\setcounter{tocdepth}{1}
\newtcolorbox[auto counter,number within=chapter,list inside=box]{test}[2][]{
enhanced,
colback=red!25,
colframe=red!25,
fonttitle=\bfseries,
coltitle=black,
arc=0pt,outer arc=0pt,
drop shadow,
title=Box~
\thetcbcounter.\quad#2,#1}
\begin{document}
\tableofcontents
\tcblistof[\chapter*]{box}{Lijst van Boxen}
\chapter{Test}
\lipsum[1]
\begin{test}{Example}
This is an example
\end{test}
\chapter{Test continued}
\lipsum[2]
\begin{test}{Next example}
More text
\end{test}
\end{document}
我得到的是:
1.1 框 1.1. 示例 . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1 框 2.1。下一个示例 . . . . . . . . . . . . . . . . . . . . . . . 11
应该:
框 1.1. 示例 . . . . . . . . . . . . . . . . . . . . . . . . . 9
框 2.1. 下一个示例 . . . . . . . . . . . . . . . . . . . . . . . . 11
答案1
将此添加到你的序言中
\makeatletter
\def\tcb@addcontentsline#1#2{%
\ifx\kvtcb@listentry\@empty%
\ifx\kvtcb@title\@empty%
\ifx\tcbtitletext\@empty%
\addcontentsline{#1}{#2}{{\ignorespaces\kvtcb@savedelimiter}}%
\else%
\addcontentsline{#1}{#2}{{\ignorespaces\tcbtitletext}}%
\fi%
\else%
\addcontentsline{#1}{#2}{{\ignorespaces\kvtcb@title}}%
\fi%
\else%
\addcontentsline{#1}{#2}{\kvtcb@listentry}%
\fi%
}
\makeatother
答案2
这应该可行;用[...]
I 表示\begin{document}
文件中前面的所有内容:
[...]
\makeatletter % no indent for entries
\renewcommand{\l@tcolorbox}{\@dottedtocline{1}{0pt}{2.3em}}
\makeatother
\begin{document}
\tableofcontents
\begingroup
% temporarily make \numberline do nothing
\renewcommand\numberline[1]{}
\tcblistof[\chapter*]{box}{Lijst van Boxen}
\endgroup
答案3
可以使用 明确设置列表的文本list entry
,如下所示:
list entry=Box~\thetcbcounter.\quad#2,
综上所述,得出:
\documentclass[numbers=noenddot,12pt,footinput=true,headinput=true,cleardoublepage=empty,twoside,svgnames,colorlinks=true]{scrbook}
\usepackage{scrlfile}
\PreventPackageFromLoading{mathpazo}
\usepackage[parts,pdfspacing,manychapters,dottedtoc,drafting]{classicthesis}
%manychapters,eulerchapternumbers,eulermath,listings,linedheaders
\usepackage{lmodern}
\usepackage{textcomp}
\usepackage[T1]{fontenc}
\usepackage[outer=7cm, inner=1.5cm, marginparwidth=4.5cm,marginparsep=.6cm, textheight=674pt]{geometry}%showframe
\usepackage[dutch]{babel}
\usepackage{xspace}
\usepackage{tocbibind}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage[font=footnotesize,font=rm,labelfont={bf,rm},format=plain,style=default]{caption}
\usepackage{subcaption}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{float}
\usepackage[utf8]{inputenc}
\usepackage[framemethod=tikz]{mdframed}
\usepackage[most,listings]{tcolorbox}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{arsclassica}
\usepackage{threeparttable}
\usepackage{lipsum}
\setcounter{tocdepth}{1}
\newtcolorbox[auto counter,number within=chapter,list inside=box]{test}[2][]{
enhanced,
colback=red!25,
colframe=red!25,
fonttitle=\bfseries,
coltitle=black,
arc=0pt,outer arc=0pt,
drop shadow,
title=Box~\thetcbcounter.\quad#2,
list entry=Box~\thetcbcounter.\quad#2,
#1}
\begin{document}
\tableofcontents
\tcblistof[\chapter*]{box}{Lijst van Boxen}
\chapter{Test}
\lipsum[1]
\begin{test}{Example}
This is an example
\end{test}
\chapter{Test continued}
\lipsum[2]
\begin{test}{Next example}
More text
\end{test}
\end{document}