
Nos códigos a seguir, tento enviar um índice com duas colunas por etoc
pacote. Coloquei esse toc em um tcolorbox
porque o tcolorbox tem a capacidade de quebrar a página. A composição real, entretanto, está fora do meu desejo. Não sei se isso é problema do etoc ou tcolorbox ou do uso incorreto deles. Alguém pode ajudar nisso?
Códigos:
\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}
Responder1
Isso pode servir como um MWE.
Você deseja que o tcolorbox de (2) faça uma quebra de página como o tcolorbox de (1).
Isso está correto?
(1). tcolorbox dentro de multicols
(2). multicols dentro do tcolorbox
MWE
\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}