목차에서 너무 많은 hbox를 수정하면 너무 많은 점이 제거됩니다.

목차에서 너무 많은 hbox를 수정하면 너무 많은 점이 제거됩니다.

이 질문은회고록 목차잘 작동하는 답변이 있지만 점이 너무 빨리 끝납니다(제 생각에는).

전체 hbox를 트리거하지 않고 도트를 기본값과 비슷하게 만드는 방법이 있습니까? (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가 너무 가득 차 있고 두 번째는 hbox를 제거하지만 점이 충분하지 않습니다).

가득 찬 hbox 이미지 도트가 부족한 이미지

나는 이것을 찾았다texdoc memman

\newcommand*{\l@section}{\@dottedtocline{1}{1.5em}{2.3em}}

아마도 그 크기는 간격과 관련이 있을 것입니다.

답변1

그만큼memoir 선적 서류 비치언급(섹션9.1 일반적인 ToC 방법, 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을 초과하는 경우 이를 감당해야 합니다. 더 많은 fot을 갖고 싶다면 다음과 같이 점 사이의 간격을 조정할 수 있습니다.

\renewcommand*{\cftdotsep}{2}

여기에 이미지 설명을 입력하세요

회고록의 경우 pnumwidthtocmarg명령을 사용하여 변경할 수 있습니다.

\setpnumwidth{2.5em}
\setrmarg{4em}

관련 정보