1

I'm working on the table of contents for my dissertation, using titlesec and titletoc. I finally figured out how to setup the margins of the chapter entries to be aligned with the part, except the space between the colon and the chapter name doesn't look wide enough. Can I get more space between the Chapter X: and the name without messing up the alignment of the left side?

Also, how can I get a colon after the Roman numeral of the part, i.e. Part I: Text.

Thanks!

\documentclass[12pt]{report} %12 pt font

\usepackage[letterpaper,margin=1in]{geometry} %paper size and margins

\usepackage{titletoc}
\titlecontents{part}[0in]{\vspace{\baselineskip}}%left margin and above code
{}%numbered parts
{\Large\bfseries PART \MakeUppercase}%numberless parts which is all of them?%
{}%no page number

\titlecontents{chapter}[1in]{}%left margin and above code
{\contentslabel[\MakeUppercase{\chaptername}~\thecontentslabel:~]{1in}\MakeUppercase}%numbered chapters
{\hspace*{-1in}\MakeUppercase}%numberless chapters%
{\titlerule*[.5pc]{.}\contentspage}%fill with dots

\usepackage{titlesec}
\titleformat{\chapter}{\bfseries\centering}{CHAPTER \thechapter: }{0em}{\MakeUppercase}
\titleformat{\section}{\bfseries}{\thesection }{0em}{}
\titlespacing{\chapter}{0em}{0em}{\parskip} %reduce vertical spacing before and after chapter headings

\setcounter{tocdepth}{1} %show sections in TOC

\begin{document}
    \tableofcontents

    \part{Text}
    
    \chapter{A Numbered Chapter}
    \chapter*{An unnumbered chapter}
    \addcontentsline{toc}{chapter}{An unnumbered chapter}
    
    \part{Scores}

    \chapter*{An unnumbered chapter}
    \addcontentsline{toc}{chapter}{An unnumbered chapter}
    \addcontentsline{toc}{chapter}{These will be PDFs}
    \section*{This is a section}
    \addcontentsline{toc}{section}{This is a section}
\end{document}```

1 Answer 1

2

You have to load titlesec with option [newparttoc] and redefine the format of \part, and the formatting of the parts in the toc with \titlecontents. Here is a solution. For the format of \part, I tried to obtain a layout as close as possible as the default in the report class.

\documentclass[12pt]{report} %12 pt font
\usepackage{xcolor}
\usepackage[letterpaper,margin=1in]{geometry} %paper size and margins

\usepackage{titletoc}
\titlecontents{part}[0in]{\vspace{\baselineskip}}%left margin and above code
{\Large\bfseries PART \MakeUppercase\thecontentslabel{:} }%numbered parts
{\Large\bfseries PART \MakeUppercase}%numberless parts which is all of them?%
{}%no page number

\titlecontents{chapter}[1.1in]{}%left margin and above code
{\contentslabel[\MakeUppercase{\chaptername}~\thecontentslabel: ]{1.1in}\MakeUppercase}%numbered chapters
{\hspace*{-1.1in}\MakeUppercase}%numberless chapters%
{\titlerule*[.5pc]{.}\contentspage}%fill with dots

\usepackage[newparttoc]{titlesec}

\titleformat{\part}[display]{\huge\bfseries\filcenter}{\partname\,\Roman{part}}{2ex}{}[\clearpage]
\titlespacing{\part}{0ex}{*36}{*10}
\titleformat{\chapter}{\bfseries\centering}{CHAPTER \thechapter: }{0em}{\MakeUppercase}
\titleformat{\section}{\bfseries}{\thesection }{0em}{}
\titlespacing{\chapter}{0em}{0em}{\parskip} %reduce vertical spacing before and after chapter headings

\setcounter{tocdepth}{1} %show sections in TOC

\begin{document}

    \tableofcontents

    \part{Text}

    \chapter{A Numbered Chapter}
    \chapter*{An unnumbered chapter}
    \addcontentsline{toc}{chapter}{An unnumbered chapter}

    \part{Scores}

    \chapter*{An unnumbered chapter}
    \addcontentsline{toc}{chapter}{An unnumbered chapter}
    \addcontentsline{toc}{chapter}{These will be PDFs}
    \section*{This is a section}
    \addcontentsline{toc}{section}{This is a section}

\end{document} 

enter image description here

5
  • Thanks! I have two questions: 1. It seems that the colon in the table of contents doesn't appear unless the titlesec line is there. Why is that? 2. Why isn't the \MakeUppercase working on the part title in the table of contents?
    – Jon Arnold
    Oct 26, 2021 at 15:56
  • What are these questions?
    – Bernard
    Oct 26, 2021 at 15:57
  • Sorry- accidentally submitted the comment instead of linebreaking. I answered the uppercase problem by moving the \MakeUppercase after the colon.
    – Jon Arnold
    Oct 26, 2021 at 16:00
  • 1
    For your 2nd question, \MakeUppercase probably doesn't work for parts because latex includes \part in the toc in a non-standard way – which is also the reason why one has to redefine first the part title formatting with titlesec.
    – Bernard
    Oct 26, 2021 at 16:07
  • I see. Thanks for your help!
    – Jon Arnold
    Oct 26, 2021 at 16:13

You must log in to answer this question.

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