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.

When adding a chapter entry in the toc, I would like to get it as the other chapters, ie capitalized… For instance, add this line

\addcontentsline{toc}{chapter}{Test}

between these two lines of ClassicThesis.tex (around line 213 in my version):

\cleardoublepage\part{Some Kind of Manual}
\include{Chapters/Chapter01}

It tried to modify classicthesis.sty without success by changing (around line 570

\newcommand\ChapS[1]{\oldchap*{#1}}%

to

\newcommand\ChapS[1]{%
  \ifpdf\oldchap*{\texorpdfstring{\spacedlowsmallcaps{#1}}{#1}}%
  \else\oldchap*{\spacedlowsmallcaps{#1}}%
  \fi%
}

Any help will be greatly appreciated… Thanks! :)

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

The classicthesis package uses titlesec to handle its title formatting. titlesec strongly discourages the use of starred versions of things. Instead (as outlined in the titlesec documentation) it recommends creating environments for unnumbered sections or chapters. Here's an example that solves your problem.

\documentclass[oneside,letterpaper]{scrbook}
\usepackage{classicthesis}
\usepackage{lipsum} % for dummy text
\newenvironment{unnumbered}%
{\setcounter{secnumdepth}{-1}}
{\setcounter{secnumdepth}{2}}
\begin{document}
\tableofcontents
\chapter{A  regular chapter}
\lipsum
\begin{unnumbered}
\chapter{An unnumbered chapter}
\lipsum
\end{unnumbered}
\end{document}
share|improve this answer
    
Thanks for the tip. However, as I mentioned below it does not change the display of lines added with \addcontentsline. Apparently I missed something when I understood that \addcontentsline{toc}{chapter}{Title} adds a chapter* line in the toc. This is really the behaviour I want to change… –  Thomas Julou Apr 25 '11 at 16:32
    
@Thomas But my solution does exactly that. Unless I'm missing something. You don't need to use the \addcontentsline command; the \chapter{} command will do that automatically. Wrapping the chapter in the unnumbered environment supresses the number in the chapter just as if you had done chapter*. –  Alan Munn Apr 25 '11 at 17:27
    
Sorry, you're right… I'm getting really too tired! Thank you :) –  Thomas Julou Apr 25 '11 at 19:07
add comment

Don't modify classicthesis.sty: you'll lose either your modifications or improvements of the package in case it's updated.

You can obtain automatic insertion of unnumbered chapters by writing in your document's preamble

\makeatletter
\g@addto@macro\tableofcontents{
  \renewcommand{\ChapS}[1]{\cleardoublepage
    \phantomsection\oldchap*{#1}
    \addcontentsline{toc}{chapter}
      {\texorpdfstring{\spacedlowsmallcaps{#1}}{#1}}}
}
\makeatother

The \makeatletter and \makeatother are not necessary and \g@addto@macro can be substituted with \addto if babel is loaded.

However this will also put the list of tables and list of figures in the table of contents; if you don't want this, just put the code

\renewcommand{\ChapS}[1]{\cleardoublepage
  \phantomsection\oldchap*{#1}
  \addcontentsline{toc}{chapter}
    {\texorpdfstring{\spacedlowsmallcaps{#1}}{#1}}}

after the \listof... commands.

One might also refrain from automatic insertion of unnumbered chapters in the toc and do the thing manually, say for the introduction:

\cleardoublepage\phantomsection
\chapter*{Introduction}
\addcontentsline{toc}{chapter}{%
  \texorpdfstring{\spacedlowsmallcaps{Introduction}{Introduction}}}
share|improve this answer
    
This has the unfortunate side-effect of adding "Contents" to the table of contents (since the table of contents is a \chapter*{}). –  Alan Munn Apr 24 '11 at 23:19
    
@Alan: you're right, I modified the answer. –  egreg Apr 24 '11 at 23:38
    
The second snippet of code seems to have no effect, no matter where it is placed. (I assume you meant before the \listof commands?) –  Alan Munn Apr 25 '11 at 0:36
    
This actually adds chapter* to the toc… but does not change the display of lines added with \addcontentsline. Apparently I missed something when I understood that \addcontentsline{toc}{chapter}{Title} adds a chapter* line in the toc. This is really the behaviour I want to change… –  Thomas Julou Apr 25 '11 at 9:07
    
@Alan: If I put the second snippet of code after \listoftables and \listoffigures, a subsequent \chapter*{Introduction} typesets a correctly formatted line in the table of contents. –  egreg Apr 25 '11 at 10:00
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.