
這個問題關於回憶錄目錄有一個效果很好的答案,但是,這些點結束得太快了(在我看來)。
有沒有辦法讓點更像預設值而不觸發過滿的水平盒? (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}
這是一些範例圖像(第一個有我喜歡的點,但水平盒過滿,第二個刪除了水平盒但沒有足夠的點):
我發現這個在texdoc memman
\newcommand*{\l@section}{\@dottedtocline{1}{1.5em}{2.3em}}
也許這些尺寸與間距有關。
答案1
這memoir
文件提及(部分9.1 通用目錄方法,第 142 頁):
頁碼在 width 的框框中右對齊排版
\@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}