1

I have a document of class book, and I have several chapters and sections in this document. Additionally, I group several chapters under one part, so I call \part to do this. At the end of my document, I have the appendices, which I start with \appendix. There are several chapters, and I would like to do the same here: to group them into a 'part' called Appendices.

So I call \part*{Appendices}. However, in the ToC, this entry contains the word 'Part'. I would like to know what I can do to remove that single word 'Part' for that single entry.

Thank you,

Below is an example MWE

\documentclass[12pt,a4paper,oneside,openany]{book}



% *** FONTS AND TYPESETTING PACKAGES ***
%
\usepackage{titlesec}
\usepackage{titletoc}



% *** PAGE FORMATTING PACKAGES ***
%
\usepackage{appendix}



%
%% Macros & Preambles
%
%% ToC/LoFT formatting
\titlecontents{part}                     % Section
[0pt]                                    % Left(-indent)
{\vspace{10pt}\filcenter\Large\bfseries} % Before contentslabel
{}                                       % Format for numbered entry
{\partname\ \thecontentslabel}           % Format for unnumbered entry
{}                                       % Filler page format
[\vspace{12pt}]                          % After
%%
\makeatletter
\g@addto@macro\appendix{%
  \addtocontents{toc}{\protect\renewcommand{\protect\partname}{Appendices}}%
}
\makeatother

\titlecontents{chapter}                  % Section
[0pt]                                    % Left(-indent)
{\vspace{6pt}}                           % Before contentslabel
{\bfseries\chaptername\ \thecontentslabel\ } % Format for numbered entry
{\rmfamily\thecontentslabel}             % Format for unnumbered entry
{\titlerule*{.}\contentspage}            % Filler page format
[\vspace{6pt}]                           % After
%%
\makeatletter
\g@addto@macro\appendix{%
  \addtocontents{toc}{\protect\renewcommand{\protect\chaptername}{\appendixname}}%
}
\makeatother

%% Page title-ing
\titleformat{\part}[block]%
{\filcenter\large\bfseries}%
{\partname\ \thepart:\ }%
{5pt}%
{\large}

\titleformat{\chapter}[display]%
{\normalfont\large\bfseries}%
{\vspace*{-40pt} \centering \chaptertitlename\ \thechapter}%
{40pt}%
{\vspace*{-20pt} \centering \large}

\titlespacing*{\chapter}{0pt}{20pt}{20pt}

\titlespacing*{name=\chapter,numberless}{0pt}{0pt}{20pt}
%%



\begin{document}

\frontmatter

%% TABLE OF CONTENTS
\cleardoublepage
{
\tableofcontents
}


\mainmatter

%% PART I
\newpage
\part{Part}


% Chapter II
\newpage
\chapter{Chapter}
{
    \section{Section 1}
    Test

    \section{Section 2}
    Test
}


%% APPENDIX
\appendix
\newpage
\part*{Appendices}


% Appendix A

\newpage
\chapter{Appendix}
{
    Test
}


\end{document}

  • Try using the appendix package after reading the documentation (> texdoc appendix). – Peter Wilson Oct 21 '19 at 17:01
  • My bad, I didn't need to \begin{appendices} at all. I've corrected the MWE. – KaiserHaz Oct 23 '19 at 16:29
  • I did find out that if I called \renewcommand{\partname}{} before \tableofcontents this will remove Part from all ToC entries at that level. I did some reading and found out that \contentsline is called to effectively write the ToC entries. For the entry in which I'm interested, \contentsline's first argument is part, so I'm assuming it's running some low-level code behind to append the correct \partname. – KaiserHaz Oct 23 '19 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.
https://tex.stackexchange.com/questions/512973/removing-the-word-part-from-toc-entry-documentclass-book-and-titlesec
tex.stackexchange.com
crawl=CC-MAIN-2020-45
143348
application/http; msgtype=response
sha1:7RFZXSXFNT6OEHZHBUCFELX7M3CX2YJH
<urn:uuid:475652ee-75ae-439c-ae85-4ca0ec44ad27>
2020-10-22T03:58:19Z
151.101.129.69
text/html
sha1:M6PX43UKAD4OT7XTWJXX6DO6F5OL4G6I
<urn:uuid:a07976b1-6fc4-4a3e-a74c-66902e4e2547>
https://tex.stackexchange.com/questions/512973/removing-the-word-part-from-toc-entry-documentclass-book-and-titlesec
response
<urn:uuid:added4ff-f2b0-4339-b7cc-c6e6b924bfe5>
isPartOf: CC-MAIN-2020-45
publisher: Common Crawl
description: Wide crawl of the web for October 2020
operator: Common Crawl Admin (info@commoncrawl.org)
hostname: ip-10-67-67-18.ec2.internal
software: Apache Nutch 1.17 (modified, https://github.com/commoncrawl/nutch/)
robots: checked via crawler-commons 1.2-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)
format: WARC File Format 1.1
conformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/