I am writing my thesis. The grad school requirement is that in TOC the dots leading to page number should extend till the number. I can get this by defining pnumwidth = 0 but then the problem is that all page numbers are left aligned. How can I keep then right align and still get the dots to end at the number (no gaps between number and dots for all entries)

  • 3
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Aug 14 '14 at 20:04

EDIT: I came up with an automatic solution. Just add this to the preamble:



This redifeines the pnumwidth at the beginning of every page to be the width of the actual page number. Its was a little too wide still, leaving a space between the leader and the number, so added the -.2em. I don't know why that is and perhaps someone can improve the code. I tested it on my ongoing project and it looks nice:

enter image description here


I'm struggling with this myself at the moment. The thing I came up with is to first set the width of the page number box to be small. Then you compile the document and locate the 10th and the 100th page and change it there. This is made somewhat more easy with tocloft. A not so optimal solution but it works.

I'm using the calc package to get the with of numbers.





\chapter{Some chapter}
\section{Some section}

\chapter{Other chapter}
\section{Other section}

\chapter{Other chapter}
\section{Other section}

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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