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 am trying to achieve the following layout of the table of contents

enter image description here

But I'm a little lost on how to use the titlesec package, because I do not know if this package is really for editing the table of contents or just for the titles...

I appreciate your help

Current advances:

\documentclass[letterpaper,12pt,oneside,onecolumn,final,openany]{report}
\usepackage[left=2.7cm,top=2.5cm,right=2.2cm,nohead,nofoot]{geometry}
\usepackage{titlesec}
\usepackage{tocloft}

\renewcommand{\cftaftertoctitle}{\hrulefill}

\begin{document}
\pagenumbering{roman}
\tableofcontents
\clearpage
\listoffigures
\clearpage
\listoftables
\clearpage
\pagenumbering{arabic}

\chapter{Introduction}
\label{chap:intro}
Lorem 

\section{Lorem ipsum}
\label{sec:intro:lorem}

Pellentesque

\subsection{Ipsum}
\label{sec:intro:ipsum}

Etiam 

Result:

Result

share|improve this question
1  
What you have tried so far? Please add a minimal working example (MWE). –  Harish Kumar May 19 '12 at 22:51
    
A few remarks: 1) Please embed your document as an image. I'm sure you'll understand people will be hesitant to download a pdf file of a total stranger. 2) You can check out what titlesec does in its documentation: texdoc.net/pkg/titlesec 3) I haven't done a loft of ToC modification, but I think tocloft is a popular package for that. I suggest you check that out, try to achieve your layout and if there's something specific you can't figure out, you're more than welcome to come back and ask about it. –  doncherry May 19 '12 at 22:56
    
Should the format for the title apply to all chapters or just to the Table of Contents? –  Gonzalo Medina May 19 '12 at 23:33
add comment

1 Answer

up vote 7 down vote accepted

Here's one possible option: the titlesec package was used to format the title for unnumbered sections; the tocloft package was used to format the section entries in the ToC (only change was to typeset chapter entries in \normalfont):

\documentclass{report}
\usepackage{titlesec}
\usepackage[titles]{tocloft}

\renewcommand\cftchapfont{\normalfont}
\renewcommand\cftchappagefont{\normalfont}

\AtBeginDocument{\renewcommand\contentsname{Table of Contents}}

\titleformat{\chapter}[display]
{}{\hfill\rule{.7\textwidth}{3pt}}{0pt}
{\hspace*{.3\textwidth}\huge\bfseries}[\addvspace{-1pt}]
\titleformat{name=\chapter,numberless}[display]
{}{\hfill\rule{.7\textwidth}{3pt}}{0pt}
{\hspace*{.3\textwidth}\huge\bfseries}[\addvspace{-1pt}]

\begin{document}

\tableofcontents
\clearpage

\chapter{Test Chapter}
\section{Test Subsection}

\end{document}

enter image description here

Since the OP didn't provide any information regarding the formatting for titles of numbered chapters, my example code included a provisional definition in this case.

As a side note, I used that you need roman numbering for the frontmatter part of your document and then arabic numbering in the mainmatter part: this suggests that switching to the book document class might be a sensible choice, since now you can use \frontmatter, \mainmatter, and \backmatter which will give you some automatic formatting for page numbering (amongst other things); I also used the tocbibind package to easily include into the ToC entries for the LoF and LoT :

\documentclass{book}
\usepackage[nottoc]{tocbibind}
\usepackage{titlesec}
\usepackage[titles]{tocloft}

\renewcommand\cftchapfont{\normalfont}
\renewcommand\cftchappagefont{\normalfont}

\AtBeginDocument{\renewcommand\contentsname{Table of Contents}}

\titleformat{\chapter}[display]
{}{\hfill\rule{.7\textwidth}{3pt}}{0pt}
{\hspace*{.3\textwidth}\huge\bfseries}[\addvspace{-1pt}]
\titleformat{name=\chapter,numberless}[display]
{}{\hfill\rule{.7\textwidth}{3pt}}{0pt}
{\hspace*{.3\textwidth}\huge\bfseries}[\addvspace{-1pt}]

\begin{document}

\frontmatter
\tableofcontents
\listoftables
\listoffigures

\mainmatter
\chapter{Test Chapter}
\section{Test Subsection}

\end{document}

enter image description here

share|improve this answer
    
When I change the document class to report, it does not work. Any ideas? Thanks anyway, you have point me in a good direction :D –  aljndrrr May 19 '12 at 23:46
    
@aljndrrr: I edited my answer to use report. –  Gonzalo Medina May 19 '12 at 23:47
    
@aljndrrr in fact, I've just updated my answer again suggestiong you to use book instead of report and providing the corresponding code. –  Gonzalo Medina May 19 '12 at 23:53
    
Thank you @gonzalo-medina this is what I was looking for –  aljndrrr May 20 '12 at 0:15
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.