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.

Help me, please to make the style of "Contents" heading to be as \chapter{Le choix du thème}.

Also I would like to put all headings a little bit higher and to fix the hyperref for "Contents" in pdf

\documentclass[12pt]{report} 

\usepackage{fontspec}
\usepackage[hidelinks]{hyperref}

\usepackage{xunicode}
\usepackage[no-sscript]{xltxtra}
\usepackage{csquotes}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\setotherlanguages{german,english,greek,polish,russian}

\setmainfont[Mapping=tex-text]{CMU Serif}

\usepackage{setspace}
\usepackage{tocloft}



\newfontfamily\greekfont[Script=Greek,Mapping=tex-text]{CMU Serif}
\newfontfamily\russianfont[Script=Cyrillic,Mapping=tex-text]{CMU Serif}

\usepackage{titlesec}

\titleformat{\chapter}[display]% NEW
    {\Huge\bfseries\centering}{\chaptertitlename\ \thechapter}{5pt}{\Large}% NEW
\titlespacing*{\chapter}{0pt}{30pt}{20pt}% NEW
\titleformat{\section}
  {\bfseries}
  {\thesection}{1em}{}


\renewcommand\cftchappresnum{\chaptername\newline}
\setlength{\cftchapnumwidth}{3.5cm}


\renewcommand{\thechapter}{}
\renewcommand{\thesection}{\Roman{section}.}



\usepackage[backend=biber,style=verbose-ibid,citepages=suppress,sorting=nty,babel=other]{biblatex}

\renewcommand\mkbibnamelast[1]{\textsc{#1}}



\begin{document}

\doublespacing

\tableofcontents




\renewcommand{\chaptername}{Préface}
\addtocontents{toc}{\protect\renewcommand\protect\chaptername{Préface}}
\chapter{Le choix du thème}
Balah blah blah L'Organisation des Nations unies (ONU) 


\renewcommand{\chaptername}{Introduction}
\addtocontents{toc}{\protect\renewcommand\protect\chaptername{Introduction}}
\chapter{Initiatives du PO}
\section{Les lettres du PO 1904}
Balah blah blah (ONU) 



\renewcommand{\thechapter}{\arabic{chapter}}
\renewcommand{\thesection}{\thechapter.\arabic{section}}
\setcounter{chapter}{0}
\setcounter{section}{0}
\renewcommand{\chaptername}{Chapitre}
\addtocontents{toc}{\protect\renewcommand\protect\chaptername{Chapitre}}
\chapter{Les décisions des CP}
\section{Les décisions des CP de Rhodes 1964}


\chapter{L'ouvre de la CIP}
\section{Les décisions de la I\textsuperscript{re} CPP}


\chapter{Évaluation de l'œuvre accomplie et perspectives}
\section{Évaluation de l'œuvre accomplie}


\renewcommand{\thechapter}{}
\renewcommand{\chaptername}{Conclusion}
\addtocontents{toc}{\protect\renewcommand\protect\chaptername{Conclusion}}
\chapter{}




\printbibheading[heading=bibintoc]
\printbibliography[keyword=primary,heading=subbibliography,title={Les sources principaux}]
\printbibliography[keyword=secondaire,heading=subbibliography,title={Les sources secondaires}]

\end{document}

Thank you.

share|improve this question
2  
Please keep in mind to keep the example code minimal, i.e. to strip all non-essential code from it. For example I couldn't compile it until a removed the font selection macros because I don't have the CMU Serif font installed. –  Martin Scharrer May 30 '11 at 19:44
    
What do you mean by "fix the hyperref for "Contents" in pdf"? –  N.N. May 30 '11 at 19:47
    
@N.N. I mean that after the compilation when I click to the first chapter in content of pdf file it sends me to Preface. –  filokalos May 30 '11 at 19:54
add comment

3 Answers

up vote 5 down vote accepted

You didn't provide a mimimal example, but by stripping down your code, I was at least able to fix the most serious problem, i.e. the ToC title not obeying the formatting of other chapter titles (e.g. not being centered). The reason for this is that by loading the tocloft package you disabled the influence of titlesec on the table of contents. Use the macros provided by tocloft instead. (I didn't bother to delve into your hyperref problems, as hyperref and titlesec also don't go together well.)

EDIT: hyperref problem solved. Your rather non-standard way of redefining \thechapter created two chapters numbered with 1 (although the number was hidden in case of the Introduction), and this confused hyperref. Solution: Set the chapter counter to -1 before the Introduction, which will then become chapter 0.

\documentclass[12pt]{report} 

\usepackage[utf8]{inputenc}

\usepackage{titlesec}

\titleformat{\chapter}[display]
    {\Huge\bfseries\centering}{\chaptertitlename\ \thechapter}{5pt}{\Large}
\titlespacing*{\chapter}{0pt}{30pt}{20pt}
\titleformat{\section}
    {\bfseries}{\thesection}{1em}{}

\usepackage{tocloft}

\renewcommand\cftchappresnum{\chaptername\newline}
\setlength{\cftchapnumwidth}{3.5cm}

% These redefinitions were missing
\renewcommand{\cfttoctitlefont}{\hfill\Large\bfseries}
\renewcommand{\cftaftertoctitle}{\hfill}
\setlength{\cftbeforetoctitleskip}{30pt}
\setlength{\cftaftertoctitleskip}{20pt}

\usepackage{hyperref}

\begin{document}

\tableofcontents

\setcounter{chapter}{-1}
\renewcommand{\thechapter}{}
\renewcommand{\thesection}{\Roman{section}.}
\renewcommand{\chaptername}{Introduction}
\addtocontents{toc}{\protect\renewcommand\protect\chaptername{Introduction}}
\chapter{Initiatives du PO}
\section{Les lettres du PO 1904}
Balah blah blah (ONU) 

\renewcommand{\thechapter}{\arabic{chapter}}
\renewcommand{\thesection}{\thechapter.\arabic{section}}
\renewcommand{\chaptername}{Chapitre}
\addtocontents{toc}{\protect\renewcommand\protect\chaptername{Chapitre}}
\chapter{Les décisions des CP}
\section{Les décisions des CP de Rhodes 1964}

\chapter{L'ouvre de la CIP}
\section{Les décisions de la I\textsuperscript{re} CPP}

\renewcommand{\thechapter}{}
\renewcommand{\chaptername}{Conclusion}
\addtocontents{toc}{\protect\renewcommand\protect\chaptername{Conclusion}}
\chapter{}

\begin{thebibliography}{9}
\bibitem{A01} A bibitem.
\end{thebibliography}

\end{document}
share|improve this answer
    
@locstep Thank you. That is exactly I need.:) –  filokalos May 30 '11 at 20:57
    
@filokalos: No -- now it is exactly what you need. ;-) –  lockstep May 30 '11 at 21:00
    
@locstep Yes. You right. :))) Thank you. –  filokalos May 30 '11 at 21:26
add comment

You simply need to redefine \contentsname. The babel package does this automatically for the selected language (for latex/pdflatex). The polyglossia package seems to do the same for XeLaTeX. Because this happens at the \begin{document} you need to redefine it afterwards. At best directly before it.

\renewcommand{\contentsname}{Le choix du thème}
\tableofcontents
share|improve this answer
    
Thank you. But I mean to make the heading "Contents" which appears by \tableofcontents to look like \chapter{Le choix du thème}. –  filokalos May 30 '11 at 19:48
    
@filokalos: \tableofcontents should already use \chapter*. There should be no chapter number for the ToC. –  Martin Scharrer May 30 '11 at 20:19
    
Thank you. I'll change it. –  filokalos May 30 '11 at 20:55
add comment

You can use \renewcommand*\contentsname{new name} like suggested in a thread on LaTeX community. Notice that the thread also recommends against that solution.

To turn the table of contents into a chapter use:

\makeatletter
\renewcommand\tableofcontents{%
        \chapter{\contentsname
        \@mkboth{%
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
        \@starttoc{toc}%
        }
\makeatother

I think there is a better solution though. This seems dirty.

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.