3

I have formatted Chapter titles using the package titlesec, but the formatting is unsuccessful in applying to my chapters with an asterisk *, (those chapters which I do not want appearing in my table of contents.)

That is, I would like to center and make \huge a title which corresponds to \chapter*{Some Title}.

For all my other chapters, I have successfully used:

 \titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\centering\chaptertitlename\ \thechapter}{20pt}{\huge}

How may I do this for \chapter*{}, using titlesec or otherwise?

This is under \documentclass{report}.

EDIT:

\documentclass[12pt]{report}

\usepackage{tocloft}
\usepackage{titlesec}

\begin{document}

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\centering\chaptertitlename\ \thechapter}{20pt}{\huge}

\tableofcontents{}

\addcontentsline{toc}{chapter}{Unnumbered Title}
\chapter*{Unnumbered Title}
I would like the title above centered

\chapter{Numbered Title}
...centered like this chapter heading above

\end{document}

Thank you!

2
  • 1
    Welcome. Please give us a small, compilable document which reproduces the issue. By default \titleformat affects starred as well as unstarred commands. When I try your format command, the title of unstarred chapters i not centred - only the 'Chapter X` bit which is, of course, not relevant for starred chapters.
    – cfr
    Commented Jun 24, 2015 at 0:34
  • @cfr I have reproduced the issue above, thanks for your response!
    – Brittney
    Commented Jun 24, 2015 at 0:59

1 Answer 1

6

You can have what you want with the numberless key. I'm not sure whether you want unnumbered chapters to be in the table of contents; the below code does it, but it's easy to undo it if you don't want. Just use:

\titleformat{\chapter}[display] {\normalfont\huge\bfseries\filcenter}{\chaptertitlename\ \thechapter}{20pt}{}
\titleformat{name=\chapter,numberless}[block] {\normalfont\huge\filcenter\bfseries}{}{0pt}{\huge}[\addcontentsline{toc}{chapter}{\chaptertitle}]
6
  • (+1) Just for being able to find it. Why doesn't the documentation mention that there are extensions on page 4 when explaining \titleformat as part of the 'Advanced Interface' description. Is that for the 'Very Advanced Interface'? The documentation is... leaves something to be desired.
    – cfr
    Commented Jun 24, 2015 at 1:22
  • 1
    It's described in §3.8, Extended settings. Perhaps it's because the author, a little further, ‘discourages using starred versions of sectioning commands’ in favour of ‘mark-up oriented commands’ (§ 4.2) with examples.
    – Bernard
    Commented Jun 24, 2015 at 7:35
  • Thanks. I found it, actually. But I only found it by searching for the option having seen your solution. I just find the documentation frustrating that different features of the same command are explained in a bunch of different places without even a pointer to those other places.
    – cfr
    Commented Jun 24, 2015 at 13:15
  • @cfr: You're probably right. I guess I don't have this problem only because I've been using the package for more than 15 years. I remember I had difficulties with titletoc.
    – Bernard
    Commented Jun 24, 2015 at 13:20
  • 1
    Making me think of Groucho Marx's sentence: ‘I don’t want to belong to any club that would accept me as one of its members.’
    – Bernard
    Commented Jun 24, 2015 at 14:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .