我的 MWE 按照我的意愿将目录中的章节号格式化为字符串,但它也会将章节标题中的章节号更改为字符串。我希望它在目录中是字符串,在章节标题中是数字,就像我标记的那样。我还想删除章节标题中的“章节”一词,我标记了吗?
\documentclass{memoir}
\let\ordinal\relax
\makeatletter
\renewcommand{\printtoctitle}[1]{\centering\HUGE\textit{Contents}}
% Chapter
\usepackage{fmtcount}
\renewcommand{\thechapter}{\Numberstring{chapter}}
\renewcommand{\cftchapterleader}{}
\renewcommand{\cftchapterfillnum}[1]{\hspace*{10pt}\huge#1\cftparfillskip\par}
\renewcommand*{\cftchapterfont}{}
\renewcommand\chapternumberline[1]{\hfil\Large\emph{#1}\hfil\strut\huge\par\nopagebreak\hfil}
% Document
\begin{document}
\tableofcontents*
\chapter{The First Chapter}
\end{document}
答案1
您可以定义新的章节样式。
TOC 样式
章节样式
\documentclass{memoir}
\let\ordinal\relax
\renewcommand{\printtoctitle}[1]{\centering\HUGE\textit{Contents}}
% Chapter
\usepackage{fmtcount}
\let\oldthechapter\thechapter % added <<<<<
\renewcommand{\thechapter}{\Numberstring{chapter}}
\renewcommand{\cftchapterleader}{}
\renewcommand{\cftchapterfillnum}[1]{\hspace*{10pt}\huge#1\cftparfillskip\par}
\renewcommand*{\cftchapterfont}{}
\renewcommand\chapternumberline[1]{\hfil\Large\emph{#1}\hfil\strut\huge\par\nopagebreak\hfil}
%*********************************************** added <<<<<<<<<<<<<<<<<<
\makechapterstyle{centerlike}{% new chapter heading style
\chapterstyle{default}
\renewcommand*{\chapnumfont}{\normalfont\Huge\bfseries}
\renewcommand*{\chaptitlefont}{\normalfont\Huge\bfseries}
\renewcommand*{\printchaptername}{\centering}
\renewcommand*{\printchapternum}{\chapnumfont \oldthechapter}
\renewcommand*{\printchaptertitle}[1]{\centering \chaptitlefont ##1\par}
\renewcommand*{\afterchaptertitle}{\vskip\afterchapskip}
\renewcommand*{\printchapternonum}{ \vphantom{\chapnumfont \textit{9}}\afterchapternum}
}
\chapterstyle{centerlike}% use this style
%***********************************************
% Document
\begin{document}
\tableofcontents*
\chapter{The First Chapter}
\end{document}