
В следующих кодах я пытаюсь отправить оглавление с двумя столбцами по etoc
пакету. Я поместил это оглавление в , tcolorbox
потому что tcolorbox имеет возможность разбивать на страницы. Однако реальный набор текста не входит в мои желания. Я не знаю, проблема ли это в etoc или tcolorbox или в моем неправильном использовании их. Кто-нибудь может помочь?
Коды:
\documentclass{article}
\usepackage{geometry,etoc}
\usepackage[most]{tcolorbox}
\geometry{showframe}
\begin{document}
\begin{tcolorbox}[breakable,width=5in]
\etocmulticolstyle[2]{My Content}
\tableofcontents
\end{tcolorbox}
\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}\section{sss}
\end{document}
решение1
Это может служить MWE.
Вы хотите, чтобы tcolorbox из (2) разрывал страницу, как tcolorbox из (1).
Это верно?
(1). tcolorbox внутри multicols
(2). мультиколонки внутри tcolorbox
МВЭ
\documentclass{article}
\usepackage{geometry,etoc}
\usepackage{tcolorbox}
\tcbuselibrary{breakable}
\geometry{showframe}
\begin{document}
%\newpage
%tcb:toc
%``Unbreakable tcolorboxes can be used without
%special care inside a multicols environment
%from the multicol package.
%Since version 3.10, a breakable tcolorbox
%detects, if it is used inside a multicols
%environment. But choosing break points
%for a breakable box cannot be done by the
%balancing routine of multicols. By default,
%boxes will break at maximum column
%height. To get pleasant results, use ...''
%Code adapted from:
%https://tex.stackexchange.com/questions/639275/breakable-local-table-of-contents-with-indented-page-numbers-using-etoc
\newcommand{\chaptertoc}{%
\etocsettocstyle{%
\subsection*{Heading of local toc\\\vspace{-0.75em} \rule{\textwidth}{0.4pt}\vspace{-.5em}}
}{\vspace{-0.5em}\noindent \rule{\textwidth}{0.4pt}}%
(1). tcolorbox inside multicols
\begin{multicols}{2}
\begin{tcolorbox}[
breakable,
colback=brown!5!white,
colframe=red!75!black,
fonttitle=\bfseries,
title=My breakable box,
]
\localtableofcontents
\end{tcolorbox}
\end{multicols}
}
\newpage
code
\chaptertoc
\newcommand{\revchaptertoc}{%
\etocsettocstyle{%
\subsection*{Heading of local toc\\\vspace{-0.75em} \rule{\textwidth}{0.4pt}\vspace{-.5em}}
}{\vspace{-0.5em}\noindent \rule{\textwidth}{0.4pt}}%
\begin{tcolorbox}[
breakable,
colback=brown!5!white,
colframe=red!75!black,
fonttitle=\bfseries,
title=My breakable box,
%break at=0.7\textheight,
%height fixed for=all,
]
\begin{multicols}{2}
%\begin{tcolorbox}[
%breakable,
%]
\localtableofcontents
%\end{tcolorbox}
\end{multicols}
\end{tcolorbox}
}
\newpage
(2). multicols inside tcolorbox
\revchaptertoc
\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx
\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx\section{sss} xxx xxx xxx
\end{document}