etoc과 tcolorbox를 함께 사용하여 TOC를 사용자 정의하면 예기치 않은 출력이 발생합니다.

etoc과 tcolorbox를 함께 사용하여 TOC를 사용자 정의하면 예기치 않은 출력이 발생합니다.

다음 코드에서는 패키지별로 2열의 목차를 발송하려고 합니다 etoc. tcolorboxtcolorbox에는 페이지 나누기 기능이 있기 때문에 이 항목을 a에 넣었습니다 . 그러나 실제 조판은 내가 원하는 것과 다릅니다. 이것이 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 역할을 할 수 있습니다.

(2)의 tcolorbox가 (1)의 tcolorbox처럼 페이지 나누기를 원합니다.

그 맞습니까?

(1). 멀티콜 안의 tcolorbox

옵션 1

(2). tcolorbox 내부의 멀티콜

옵션 2

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}

관련 정보