
この質問は回想録の目次うまく機能する答えがありますが、点がすぐに終わってしまいます(私の意見です)。
オーバーフル hboxes をトリガーせずに、ドットをデフォルトに近づける方法はありますか? (WME は上記の質問から直接取得されます):
\documentclass[oneside, draft]{memoir}
\usepackage[showframe]{geometry}
\usepackage{lipsum}
\newcommand{\repeattext}[1]{#1 #1 #1 #1 #1 #1}
\makeatletter
\renewcommand{\@pnumwidth}{3em} %even adjusting this down doesn't really help
\renewcommand{\@tocrmarg}{4em}
\makeatother
\begin{document}
\tableofcontents
\chapter{Chapter 1} \lipsum
\section{Section 1.1} \repeattext{\repeattext{\lipsum[1-150]}}
\chapter{Chapter 2} \lipsum[2]
\section{Section 2.1} \repeattext{\repeattext{\lipsum[1-150]}}
\chapter{Chapter 3} \lipsum[2]
\section{Section 3.1} \lipsum[2]
\end{document}
ここにいくつかのサンプル画像があります (最初の画像には気に入ったドットがありますが、hbox がいっぱいです。2 番目の画像には hbox が削除されていますが、ドットが足りません)。
私はこれを見つけましたtexdoc memman
\newcommand*{\l@section}{\@dottedtocline{1}{1.5em}{2.3em}}
おそらくそれらのサイズは間隔に関係しているのでしょう。
答え1
のmemoir
ドキュメンテーション言及(セクション9.1 一般的なToCの方法、p 142):
ページ番号は、幅 のボックス内に右揃えでタイプセットされ
\@pnumwidth
、ボックスは右余白にあります。ページ番号が長すぎてボックスに収まらない場合は、右余白からはみ出します。
のデフォルトは に\@pnumwidth
設定されていますが1.55em
、 を使用して調整できます\setpnumwidth{<len>}
。
別の方法は次のとおりです。背景を白く塗りつぶしたボックスにページ番号を設定します。
\documentclass[oneside, draft]{memoir}
\usepackage{geometry}
\usepackage{lipsum,xcolor}
\newcommand{\repeattext}[1]{#1 #1 #1 #1 #1 #1}
\makeatletter
\newcommand{\pnumformat}[1]{{\setlength{\fboxsep}{0pt}\llap{\colorbox{white}{#1}}}}
\setpnumwidth{.5em}% Just a small enough length
\renewcommand{\cftchapterformatpnum}[1]{%
\cftchapterformatpnumhook{#1}%
\hb@xt@\@pnumwidth{\hfil\pnumformat{\cftchapterpagefont #1}}}
\renewcommand{\cftsectionformatpnum}[1]{%
\cftsectionformatpnumhook{#1}%
\hb@xt@\@pnumwidth{\hfil\pnumformat{\cftsectionpagefont #1}}}
\renewcommand{\@tocrmarg}{4em}
\makeatother
\begin{document}
\tableofcontents
\chapter{Chapter 1} \lipsum
\section{Section 1.1} \repeattext{\repeattext{\lipsum[1-150]}}
\chapter{Chapter 2} \lipsum[2]
\section{Section 2.1} \repeattext{\repeattext{\lipsum[1-150]}}
\chapter{Chapter 3} \lipsum[2]
\section{Section 3.1} \lipsum[2]
\end{document}
答え2
3em
は多すぎるpnumwidth
。それを維持するだけで十分です2.5em
\makeatletter
\renewcommand{\@pnumwidth}{2.5em} %even adjusting this down doesn't really help
\renewcommand{\@tocrmarg}{4em}
\makeatother
ページ数が1000を超える場合は、そのままにしておく必要があります。より多くの写真が必要な場合は、ドット間の間隔を調整できます。
\renewcommand*{\cftdotsep}{2}
メモワールでは、コマンドでpnumwidth
とを変更できますtocmarg
\setpnumwidth{2.5em}
\setrmarg{4em}