번호와 페이지 번호 없이 목차 중앙에 부품 이름 표시

번호와 페이지 번호 없이 목차 중앙에 부품 이름 표시

수업시간 에 문서를 작성하고 있는데 bookTOC 중앙에 부품 이름이 나오도록 하고 싶습니다. 또한 부품 번호나 페이지 번호 없이 표시되어야 합니다. 다른 클래스에 대한 몇 가지 솔루션을 보았지만 작동하지 않는 것 같습니다. 코드

\documentclass{book}
\usepackage{titlesec}
\makeatletter
\renewcommand*\l@part[2]{%
  \ifnum \c@tocdepth >-2\relax
    \addpenalty{-\@highpenalty}%
    \addvspace{2.25em \@plus\p@}%
    \setlength\@tempdima{3em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      {\leavevmode
       \hspace*{\fill}\centering\large\bfseries #1\hspace*{\fill}\llap{#2}}\par
       \nobreak
         \global\@nobreaktrue
         \everypar{\global\@nobreakfalse\everypar{}}%
    \endgroup
  \fi}
\makeatother
\renewcommand{\partname}{}
\makeatletter
\titleformat{\part}[display]
  {\Huge\scshape\filright\centering}
  {}
  {20pt}
  {\thispagestyle{empty}}
\makeatother
\begin{document}
\tableofcontents
\part{This is a part of a document}
\end{document}

부품명을 중앙에 두는데 숫자는 어떻게 없애나요?

답변1

titletoc암호 코드를 조작하는 것보다 훨씬 간단합니다 .

\documentclass{book}
\usepackage[newparttoc]{titlesec}
\usepackage{titletoc} %

\titleformat{\part}[display]
  {\Huge\scshape\filright\centering}
  {}
  {20pt}
  {\thispagestyle{empty}}
\titlecontents{part}[0pt]{\addvspace{2pc}\centering\large\bfseries}{}{}{}%

\begin{document}

\tableofcontents

\part{This is a part of a document}

\chapter{Chapter Title}

\end{document} 

여기에 이미지 설명을 입력하세요

관련 정보