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 want my chapter titles to look like as asked in this post. I have followed the method suggested by "lockstep", that is, using package titlesec. It works perfectly fine but here is the question: I want this format for main chapters only and for the rest, that is Contents, Declaration, Index, Bibliography etc I want them centered with normal vertical spaces before and after the title. Pasting the code at the start of Chapter 1 solves the problem partially; it leaves the starting ones (contents, declaration) totally unchanged and applies the same format to Index and Bibliography. Please help.

share|improve this question
1  
Welcome to TeX.sx! Can you please add a minimal working example (MWE) that illustrates what you have tried till now? –  Kurt Oct 15 '12 at 20:57
add comment

2 Answers

up vote 9 down vote accepted

Since the lists (ToC, LoF, LoT), the bibliography and index usually use \chapter* to format the heading in the document, you can simply use another \titleformat command for the numberless chapters:

\documentclass{book}

\usepackage{titlesec}
\titleformat{\chapter}[display]
  {\normalfont\bfseries\filcenter}{\LARGE\thechapter}{1ex}
  {\titlerule[2pt]\vspace{2ex}}[\vspace{1ex}{\titlerule[2pt]}]
\titleformat{name=\chapter,numberless}[display]
  {\normalfont\LARGE\bfseries\filcenter}{}{1ex}
  {\vspace{2ex}}[\vspace{1ex}]

\begin{document}

\tableofcontents
\chapter{The real numbers}

\end{document}

An image of the ToC

enter image description here

and another one, of a numbered chapter:

enter image description here

share|improve this answer
    
Perfect. It did the trick. Many Many Thanks. –  user39729 Oct 15 '12 at 22:06
add comment

It appears that with the article class, the ToC title is made with \section* instead of \chapter*. In that case, the only change from Gonzalo's answer is to swap \section in for \chapter, and it has the expected effect.

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.