tocbasic を使用して、パーツのページ番号を削除し、ページ番号の前のスペースを定義します。

tocbasic を使用して、パーツのページ番号を削除し、ページ番号の前のスペースを定義します。
  1. 目次から各部のページ番号を省略したいです。

  2. ---( \mypagestyle) とページ番号の間のスペースは、不揃いであるため異なります。スペースは常に同じである必要があります。

`

\documentclass[ngerman,twoside=false]{scrbook}
\def\mypagestyle{\,\mbox{---}\,}

\RedeclareSectionCommands[
  tocraggedpagenumber,
  toclinefill={\footnotesize\mypagestyle},
  tocindent=0em,
  tocnumwidth=4em,
]{chapter,section,subsection,subsubsection,paragraph}

\RedeclareSectionCommand[
   ,tocentryformat=\large\scshape%
   ,tocindent=0em
   ,tocnumwidth=4em
]{part}

\RedeclareSectionCommand[%
    ,tocentryformat=\textbf,%
]{chapter}
\begin{document}
  \tableofcontents
  \part{part}
  \chapter{chapter chapter}
  \section{section section section}  \section{section section section}  \section{section section section}
  \part{part}
  \chapter{chapter chapter}
  \section{section section section}  \section{section section section}  \section{section section section}
  \setcounter{page}{100}
  \part{part}
  \chapter{chapter chapter}
  \section{section section section}  \section{section section section}  \section{section section section}
\end{document}

ここに画像の説明を入力してください

答え1

tocpagenumberformatページ番号の付いたボックスを変更 (または取り込む) するように設定します。

\documentclass[ngerman,twoside=false]{scrbook}

\newcommand\gobble[1]{}% <- added
\newcommand\tocpageseparator{\footnotesize\,\mbox{---}\,}
\newcommand\tocpagenumberbox[1]{\mbox{#1}}% <- added

\RedeclareSectionCommands[
  tocraggedpagenumber,
  toclinefill=\tocpageseparator,
  tocindent=0em,
  tocnumwidth=4em,
  tocpagenumberbox=\tocpagenumberbox% <- added
]{chapter,section,subsection,subsubsection,paragraph}

\RedeclareSectionCommand[
  tocentryformat=\large\scshape,
  tocindent=0em,
  tocnumwidth=4em,
  tocpagenumberbox=\gobble% <- added
]{part}

\RedeclareSectionCommand[%
  tocentryformat=\textbf%
]{chapter}
\begin{document}
  \tableofcontents
  \part{part}
  \chapter{chapter chapter}
  \section{section section section}  \section{section section section}  \section{section section section}
  \part{part}
  \chapter{chapter chapter}
  \section{section section section}  \section{section section section}  \section{section section section}
  \setcounter{page}{100}
  \part{part}
  \chapter{chapter chapter}
  \section{section section section}  \section{section section section}  \section{section section section}
\end{document}

結果:

ここに画像の説明を入力してください

関連情報