
나는 각 장의 시작 부분에 작은 목차를 넣기 위해 minitoc을 사용하여 큰 책을 쓰고 있습니다. 하지만 정말 끔찍해 보입니다.
나는 대신에 minitoc을 마주보는 페이지에 놓고 싶습니다.~ 전에장의 첫 번째 페이지. 예를 들어, 9장이 503페이지에서 시작한다면 9장의 미니톡은 502페이지에 나타나기를 원합니다.
짝수 페이지로 지우는 방법을 알고 있습니다. 문제는 대신 무엇을 사용하는가입니다.\minitoc
minitoc을 얻는 대신에 무엇을 사용하는가입니다.다음현재 장보다는 장?
답변1
당신이 사용할 수있는에톡이를 위해 tocs에 대한 label/ref 메커니즘을 통해 이루어집니다.
\documentclass{book}
\usepackage{etoc}
\usepackage{blindtext}
\makeatletter
\newcommand*\cleartoevenpage {%
\clearpage
\if@twoside \ifodd \c@page \hbox {}\newpage
\if@twocolumn \hbox {}\newpage \fi
\fi \fi }
\makeatother
\begin{document}
\tableofcontents
% switch to article like style for table of contents
% (else they will start like chapters on odd numbered pages)
% would need adjustment in two-column mode
\etocarticlestyle
\renewcommand*\etocbeforetitlehook {\cleartoevenpage}
\tableofcontents\ref{toc:first}
\chapter{First}
\invisiblelocaltableofcontents\label{toc:first}
\section{Foo}
\blindtext[2]
\subsection{FooFoo}
\blindtext[5]
\subsubsection{FooFooFoo}
\blindtext[5]
\section{Foo2}
\blindtext[3]
\subsection{FooFoo2}
\blindtext[7]
\subsubsection{FooFooFoo2}
\blindtext[7]
\tableofcontents\ref{toc:bar}
\chapter{Bar}
\invisiblelocaltableofcontents\label{toc:bar}
\section{Bar}
\blindtext[2]
\subsection{BarBar}
\blindtext[5]
\subsubsection{BarBarBar}
\blindtext[5]
\tableofcontents\ref{toc:ear}
\chapter{Ear}
\invisiblelocaltableofcontents\label{toc:ear}
\section{Ear}
\blindtext[2]
\subsection{EarEar}
\blindtext[5]
\subsubsection{EarEarEar}
\blindtext[5]
\section{Ear2}
\blindtext[3]
\subsection{EarEar2}
\blindtext[7]
\subsubsection{EarEarEar2}
\blindtext[7]
\tableofcontents\ref{toc:fur}
\chapter{Fur}
\invisiblelocaltableofcontents\label{toc:fur}
\section{Fur}
\blindtext[2]
\subsection{FurFur}
\blindtext[5]
\subsubsection{FurFurFur}
\blindtext[5]
\end{document}
스크린샷:
답변2
글쎄, 이것은 다소 숨겨진 기능이지만 별표가 있는 장 등을 minitoc
위한 \adjustmtc
명령을 제공합니다. 즉, mtc 카운터가 1만큼 꺼져 있는 경우입니다.
이 명령은 다음 장에 대한 minitoc을 제공하기 위해 '잘못 사용'될 수 있습니다.
이 \adjustmtc[n]
명령은 현재 매뉴얼의 34페이지에 설명되어 있습니다 minitoc
. 선택적 인수는 minitocs
증가할 수를 보유합니다(기본값 n=1
).
\documentclass{book}
\usepackage{minitoc}
\usepackage{blindtext}
\setcounter{minitocdepth}{3}
\setcounter{secnumdepth}{3}
\dominitoc
\begin{document}
\tableofcontents
\markboth{}{}
\clearpage
\adjustmtc
\minitoc
\chapter{First}
\section{Foo}
\blindtext[2]
\subsection{FooFoo}
\blindtext[5]
\subsubsection{FooFooFoo}
\blindtext[5]
\chapter{Foobar}
\end{document}
참고: 이 \setcounter...
명세서는 항목의 양을 채우기 위한 것일 뿐이며 minitoc
기능에는 중요하지 않습니다.
업데이트\cleartoevenpage
( `jfbu의 답변에 있는 일부 코드 포함 !)
이것은 이제 자동으로 작동합니다. 즉, 이전 짝수 페이지에 \chapter
를 추가합니다 .minitoc
\documentclass{book}
\usepackage{xparse}
\usepackage{minitoc}
\setcounter{tocdepth}{5}
\usepackage{blindtext}
\setcounter{minitocdepth}{3}
\setcounter{secnumdepth}{3}
\makeatletter
\let\latex@chapter\chapter
\newcommand*\cleartoevenpage {%
\clearpage
\if@twoside \ifodd \c@page \hbox {}\newpage
\if@twocolumn \hbox {}\newpage \fi
\fi \fi
}
% Automatic addition of minitoc
\RenewDocumentCommand{\chapter}{som}{%
\def\@@chaptertitlefortoc{#3}%
\IfValueTF{#2}{%
\def\@@chaptertitlefortoc{#2}%
}%
\IfBooleanTF{#1}{%
\latex@chapter*{#3}
}{%
\cleartoevenpage
\markboth{}{}%
\ifnum\value{chapter} = 0
\adjustmtc
\fi
\minitoc
\latex@chapter[\@@chaptertitlefortoc]{#3}
}
}
\makeatother
\dominitoc
\begin{document}
\tableofcontents
\chapter{First}
\section{Foo}
\blindtext[2]
\subsection{FooFoo}
\blindtext[5]
\subsubsection{FooFooFoo}
\blindtext[5]
\chapter{Foobar}
\blindtext[5]
\section{Foo}
\blindtext[5]
\chapter{Foobar other}
\blindtext[5]
\section{Other Foo}
\blindtext[5]
\end{document}