
私は大きな本を執筆しており、minitoc を使用して各章の始めに小さな目次を入れています。しかし、見た目がひどいです。
代わりに、ミニトックを向かいのページに置きたいのですが前に章の最初のページ。たとえば、第 9 章が 503 ページから始まる場合、第 9 章のミニ目次は 502 ページに表示されるようにします。
偶数ページにクリアする方法は知っています。問題は、\minitoc
ミニトックを取得するために代わりに何を使用するかということです。次現在の章ではなく、次の章を参照してください。
答え1
使用できますエトックこのためには、tocs のラベル/参照メカニズムを使用します。
\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
これは、いくぶん隠れた機能ですが、スター付きの章など、つまり mtc カウンターが 1 つずれている場合に使用するコマンドminitoc
を提供します。\adjustmtc
このコマンドは、次の章のミニトピックを提供するために「誤用」される可能性があります。
この\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}