[Tugindia] Stuck with formatting of \tableofcontents heading

Ravindra Jore ravindra.jore at gmail.com
Sun Jan 25 12:53:30 CET 2009


Hello all,

       I am using pdflatex. It has table of contents, which by default shows
the heading 'Contents' in the default font and left aligned.

       Instead I want it to be right-aligned and draw a horizontal line
before it. Something like this:

------------------------------------------------------------
                                                Contents



I used \renewcommand{\contentsname} as below to add formatting along with
the text 'Contents'

   \renewcommand{\contentsname}{\vspace{-40mm}
   \hspace{-35mm}\rule{158mm}{0.1pt}\vspace{-3mm}
   \pdfbookmark[0]{Contents}{anchor_contents}
   \hfill \bf\textit{\Huge Contents}}

But this shows errors. Is there any better way of formatting this?

Thank you in advance.
-Ravindra Jore


More information about the tugindia mailing list