我想制作一个看起来有点像这样的盒子。这里用一个仪表(章节号点框号)(1.2),因为会有很多。然后使用命令(\listoframe
)列出所有框。你有什么想法吗?
谢谢 !!
答案1
和tcolorbox
\documentclass{book}
\usepackage[most]{tcolorbox}
\newtcolorbox[auto counter,number within=chapter,list inside=mybox]{mybox}[2][]{%
boxrule=1pt,colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,arc=0pt,outer arc=0pt,
colbacktitle=red!85!black,enhanced jigsaw,
attach boxed title to top left=
{xshift=0mm,yshift=0mm},
boxed title style={enhanced, size=small,boxrule=0pt,arc=0pt, colback=blue!20,colframe=red,toprule=1pt,leftrule=1pt,rightrule=1pt},
title=Frame~\thetcbcounter: #2,#1}
\makeatletter % no indent for entries
\renewcommand{\l@tcolorbox}{\@dottedtocline{1}{0pt}{2.3em}}
\makeatother
\usepackage{lipsum}
\begin{document}
\begingroup
% temporarily make \numberline do nothing
\renewcommand\numberline[1]{}
\tcblistof[\chapter*]{mybox}{List of my boxes}
\endgroup
\chapter{First chapter}
\begin{mybox}[colback=yellow]{Hello there}
\lipsum[1]
\end{mybox}
\begin{mybox}[colback=yellow]{}
\lipsum[1]
\end{mybox}
\end{document}