如何创建 tcbtheorems 列表

如何创建 tcbtheorems 列表

我正在尝试获取类似于\listoftheorems但适用于tcbtheorems 的东西;理想情况下,每个特定类型的列表,tcbtheorem以防我稍后需要列出另一种类型。可能有一个简单的命令,但我找不到它。我如何修改代码以便也列出 的标题tcolorbox

问题列表:

  • 问题 1.1:一些问题
  • 问题 1.2:其他问题

我尝试改编代码tcolorbox-列表列表?以及来自我怎样才能将 tcolorbox 添加到我的目录中? 但我甚至无法让定理成为列表的一部分,所以我只得到了一个空列表。

\documentclass[a4paper,11pt]{book}

\usepackage{lipsum}
\usepackage{amsmath,amssymb}
\usepackage[most]{tcolorbox}
    \tcbuselibrary{theorems}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{lmodern}

\tcbset{
    thmbox/.style={
        enhanced,
        breakable,
        sharp corners=all,
        fonttitle=\bfseries\normalsize,
        fontupper=\normalsize\itshape,
        top=0mm,
        bottom=0mm,
        right=0mm,
        colback=white,
        colframe=white,
        colbacktitle=white,
        coltitle=black,
        attach boxed title to top left,
        boxed title style={empty, size=minimal, bottom=1.5mm},
        overlay unbroken ={
            \draw (title.south west)--(title.south east);
            \draw ([xshift=3.5mm]frame.north west)|-%
                  (frame.south east)--(frame.north east);},
        overlay first={
            \draw (title.south west)--(title.south east); 
            \draw ([xshift=3.5mm]frame.north west)--  ([xshift=3.5mm]frame.south west);
            \draw (frame.north east)--(frame.south east);},
        overlay middle={
            \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);
            \draw (frame.north east)--(frame.south east);},
        overlay last={
            \draw ([xshift=3.5mm]frame.north west)|-%
                  (frame.south east)--(frame.north east);},
    },
}

\newtcbtheorem[number within=section]{questionbox}{Question}{thmbox}{qst}

\begin{document}
\tcblistof[\section*]{qst}{List of Questions}

\chapter{foo}

\section{bla}

\begin{questionbox}{some question}{}
the answer goes here
\end{questionbox}

\begin{questionbox}{some other question}{}
the answer goes here
\end{questionbox}

\end{document}

答案1

选项必须在 的选项列表list inside=qst中使用。init\newtcbtheorem

这将启用列表功能并通知tcolorbox将列表条目写入.qst文件,并且默认情况下title将使用,除非list entry=...明确使用。

\documentclass[a4paper,11pt]{book}

\usepackage{lipsum}
\usepackage{amsmath,amssymb}
\usepackage[most]{tcolorbox}
    \tcbuselibrary{theorems}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{lmodern}

\tcbset{
    thmbox/.style={
        enhanced,
        breakable,
        sharp corners=all,
        fonttitle=\bfseries\normalsize,
        fontupper=\normalsize\itshape,
        top=0mm,
        bottom=0mm,
        right=0mm,
        colback=white,
        colframe=white,
        colbacktitle=white,
        coltitle=black,
        attach boxed title to top left,
        boxed title style={empty, size=minimal, bottom=1.5mm},
        overlay unbroken ={
            \draw (title.south west)--(title.south east);
            \draw ([xshift=3.5mm]frame.north west)|-%
                  (frame.south east)--(frame.north east);},
        overlay first={
            \draw (title.south west)--(title.south east); 
            \draw ([xshift=3.5mm]frame.north west)--  ([xshift=3.5mm]frame.south west);
            \draw (frame.north east)--(frame.south east);},
        overlay middle={
            \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);
            \draw (frame.north east)--(frame.south east);},
        overlay last={
            \draw ([xshift=3.5mm]frame.north west)|-%
                  (frame.south east)--(frame.north east);},
    },
}

\newtcbtheorem[number within=section,list inside={qst}]{questionbox}{Question}{thmbox}{qst}

\begin{document}
\tcblistof[\section*]{qst}{List of Questions}

\chapter{foo}

\section{bla}

\begin{questionbox}{some question}{}
the answer goes here
\end{questionbox}

\begin{questionbox}{some other question}{}
the answer goes here
\end{questionbox}

\end{document}

在此处输入图片描述

相关内容