Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I get Overfull warning for TOC entries when using memoir documentclass. They seem to occur when the page number for chapter title entries (highlighted in bold text) exceeds 2-digits or section page number exceeds 3-digits.

I do not get the warning for chapter headings if I switch to book documentclass. But it still happens for sections heading.

How can I fix this?

\documentclass[oneside, draft]{memoir}

\usepackage[showframe]{geometry}
\usepackage{lipsum}

\newcommand{\repeattext}[1]{#1 #1 #1 #1 #1 #1}

\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}
share|improve this question

1 Answer 1

up vote 7 down vote accepted

There are three internal LATEX commands that are used in the typesetting the table of contents, lof, lot etc. They are (with their default values):

  • \@pnumwidth = 1.55em
  • \@tocrmarg = 2.55em
  • \@dotsep = 4.5

The page number is typeset flushright in a box of width \@pnumwidth, and the box is at the righthand margin. If the page number is too long to fit into the box it will stick out into the righthand margin. This is what is happening in your case.

The title text is indented from the righthand margin by an amount given by \@tocrmarg.

\@dotsep gives the distance (in math units) between the dots in the leader.

Your problem is due to big numbers which can not be fitted into the box defined by the default value of \@pnumwidth. Hence if we make the box bigger everything will be alright. We add the following in the preamble:

\makeatletter
\renewcommand{\@pnumwidth}{3em} 
\renewcommand{\@tocrmarg}{4em}
\makeatother

Note that \@pnumwidth should be always smaller than \@tocrmarg.

For memoir these can be changed by

\renewcommand*{\cftdotsep}{1}
\setpnumwidth{3em}
\setrmarg{4em}

without any need for \makeatletter construct.

enter image description here

share|improve this answer
    
Thank you. That solved the issue. –  mythealias Mar 29 '12 at 13:05
    
+1! Are you setting 3em value of @pnumwidth since the OP mentions that the issue occurs when two digits and more are involved? In other words, is it 3em so it could hold 3 digits? –  Dror Jan 8 at 13:10
    
@Dror Thanks. Yes. The value must be adjusted depending upon number of digits page number has so as to fit it in. At the same time @tocmarg too. –  Harish Kumar Jan 8 at 22:48
    
There is already a command \setpnumwidth{} in memoir class. –  John Kormylo Mar 15 at 17:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.