4

I've created this code to style the table of contents page

\contentsmargin{0cm}
 \titlecontents{part}[-1pc]
 {\addvspace{10pt}%
 \color{doc}\Large PART\quad}%
 {}
 {}
 {}%
 %------------------------------------------
 \titlecontents{chapter}[0pc]
 {\addvspace{10pt}%
 \color{doc}\large\sc\bfseries}%
 {}
 {}
 {\;\;\normalsize\thecontentspage}%
 \titlecontents{section}[2.4pc]
 {\addvspace{1pt}}
 {\contentslabel[\thecontentslabel]{2.4pc}}
 {}
 {\hfill\small \thecontentspage}
 []
 \titlecontents*{subsection}[4pc]
 {\addvspace{-1pt}\small}
 {} 
 {}
 {\ --- \small\thecontentspage}
 [ \textbullet\ ][]

 \makeatletter
 \renewcommand{\tableofcontents}{%
 \chapter*{%
 \vspace*{-20\p@}%
 \color{doc}\contentsname}%
 \@starttoc{toc}}
 \makeatother

And I want the page number to appear to the right side of the page. Like this picture shows (without the dots):

enter image description here

mac
  • 1,479
  • Do you want the page numbers for the page(s) belonging to the Table of Contents to be placed top-right, middle-right (i.e., in the margin), or bottom-right? Separately, have you considered using the tocloft package to help design the look of the ToC? Please advise. – Mico May 02 '13 at 17:25
  • 2
    Do you want to imitate the overall look of the ToC shown in the image or just to move the page numbers for chapter entries to the right? If it's just the numbers, instead of \titlecontents{chapter}[0pc] {\addvspace{10pt} \color{doc}\large\sc\bfseries} {} {} {\;\;\normalsize\thecontentspage} use \titlecontents{chapter}[0pc] {\addvspace{10pt} \color{doc}\large\sc\bfseries} {} {} {\hfill\normalsize\thecontentspage} (as a side note, your code as it is now will produce errors since you are using ; outside math mode.) – Gonzalo Medina May 02 '13 at 19:50

1 Answers1

2

To move the page numbers for chapter entries to the right, you can use \hfill before \thecontentspage:

\titlecontents{chapter}[0pc]
  {\addvspace{10pt}\color{doc}\large\scshape\bfseries}{}{}   
  {\hfill\normalsize\thecontentspage} 

As a side note, your original code will produce errors since you are using \; outside math mode.

Gonzalo Medina
  • 505,128