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.

Some of the page numbers listed in my table of contents are long roman numerals. For some reason, these long page numbers get pushed into the right margin.

Here is a screenshot of the table of contents. Note that the "xviii" page number gets pushed into the right margin, creating a black "warning blot".

Abstract's page number violates right margin

How can I fix this? Below is some minimal code that recreates this problem:

\documentclass[12pt,draft,letterpaper]{report}
\usepackage{tocloft}

\begin{document}

\pagenumbering{roman}

% PROBLEM: In the table of contents here, the abstract's page number is pushed
%          into the right margin.
\tableofcontents
\newpage .

\section*{Acknowledgements}\addcontentsline{toc}{section}{Acknowledgements}

Here are the acknowledgements.

% a bunch of blank pages, to place the abstract on page xviii
\newpage . \newpage . \newpage . \newpage . \newpage .
\newpage . \newpage . \newpage . \newpage . \newpage .
\newpage . \newpage . \newpage . \newpage . \newpage .

\chapter*{Abstract}\addcontentsline{toc}{section}{Abstract}

This is the abstract.

\end{document}
share|improve this question
    
Try in the preamble \makeatletter \def\@pnumwidth{50pt}\makeatother –  Yiannis Lazarides Apr 27 '12 at 19:15
add comment

2 Answers

up vote 11 down vote accepted

tocloft provides \cftsetpnumwidth{<len>} which sets the value of \@pnumwidth to <len>, so you could just execute

\cftsetpnumwidth{3em}% 3em width for page numbers

after loading tocloft (see 2.3 Typesetting the entries, p 8 of the tocloft documentation):

enter image description here

share|improve this answer
add comment

Increase the space reserved to typeset the page number; add to your preamble

\makeatletter
\renewcommand\@pnumwidth{1cm}
\makeatother

and instead of 1cm use a suitable length.

Your example code:

\documentclass[12pt,draft,letterpaper]{report}

\makeatletter
\renewcommand\@pnumwidth{1cm}
\makeatother

\begin{document}

\pagenumbering{roman}

\tableofcontents

\newpage

\section*{Acknowledgements}\addcontentsline{toc}{section}{Acknowledgements}

\newpage

\setcounter{page}{18}

\chapter*{Abstract}
\addcontentsline{toc}{section}{Abstract}

This is the abstract.

\end{document}

now produces

enter image description here

share|improve this answer
add comment

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.