番号付け tcolorbox toc

番号付け tcolorbox toc

かなり大きな文書を書いているので、使用したボックスの目次を作成したいと考えています。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}

ここに画像の説明を入力してください

関連情報