如何修改\part 名称?

如何修改\part 名称?

我想修改目录中各部分的命名方式,就像在文档正文中命名一样:

首场派对

对于第一部分。

第二派对

对于第二部分,依此类推。我该怎么做?这是我的 MWE:

\documentclass[fontsize=11pt,%
               twoside=semi,%
               headings=small,%
               chapterprefix=true,%
               listof=flat]%
{scrbook}
\usepackage[utf8]{inputenc}% can be removed with an uptodate TeX distribution
\usepackage[T1]{fontenc}
\usepackage [french]{babel}
\usepackage{fontspec}
\setmainfont{Didot}
\usepackage{lipsum}
\renewcommand*{\chapterformat}{%
  \mbox{\chapappifchapterprefix{\nobreakspace}\thechapter
  \IfUsePrefixLine{}{\enskip}}%
}


\begin{document}

\tableofcontents

\part{Éléments d'analyse}

\chapter{Définitions}

\lipsum


\end{document}

答案1

您可以重新定义 KOMA-Script 命令\addparttocentry

\renewcommand\addparttocentry[2]{%
  \IfArgIsEmpty{#1}
    {\addtocentrydefault{part}{#1}{#2}}
    {\addtocentrydefault{part}
      {\csname ordinal\romannumeral\value{part}\endcsname\space\partnameord}% copied from french.ldf
      {#2}%
    }%
}%
\RedeclareSectionCommand[tocdynnumwidth]{part}% adjust the space for part number in TOC

例子:


\documentclass[%fontsize=11pt,% default
               twoside=semi,%
               headings=small,%
               chapterprefix=true,%
               listof=flat]%
{scrbook}

\usepackage[T1]{fontenc}
\usepackage [ngerman,french]{babel}
\usepackage{fontspec}
%\setmainfont{Didot}% I do not have this font
\usepackage{lipsum}
\renewcommand*{\chapterformat}{%
  \mbox{\chapappifchapterprefix{\nobreakspace}\thechapter
  \IfUsePrefixLine{}{\enskip}}%
}

\renewcommand\addparttocentry[2]{%
  \IfArgIsEmpty{#1}
    {\addtocentrydefault{part}{#1}{#2}}
    {\addtocentrydefault{part}
      {\csname ordinal\romannumeral\value{part}\endcsname\space\partnameord}% copied from french.ldf
      {#2}%
    }%
}%
\RedeclareSectionCommand[tocdynnumwidth]{part}% adjust the space for part number in TOC 

\begin{document}
\tableofcontents
\part{Éléments d'analyse}\label{p}
\chapter{Définitions}
\lipsum
\end{document}

运行三次得到:

在此处输入图片描述

相关内容