从带有回忆录的章节中删除前缀 0.

从带有回忆录的章节中删除前缀 0.

在此处输入图片描述

我编写了一个回忆录文档,其中 Contents 前面带有“0.” 。我该如何将其删除?

\documentclass[12pt,oneside]{memoir}

\title{Document}
\author{prosseek}

% http://tex.stackexchange.com/questions/97465/modify-default-memoir-chapter-style
\makeatletter
\newcommand{\fonttitle}{\chaptitlefont}
\makechapterstyle{mystyle}{%
\def\chapterheadstart{\vspace*{\beforechapskip}}
\def\printchaptername{}
\def\printchapternum{}
\def\printchapternonum{}
\def\printchaptertitle##1{\fonttitle \space \fonttitle \thechapter.\space \fonttitle ##1}
\def\afterchaptertitle{\par\nobreak\vskip \afterchapskip}
}
\makeatother

\chapterstyle{mystyle}

\begin{document}

\maketitle
\tableofcontents

\chapter{The Domain Problem and Stakeholders}
\section{First}
abcdef. 

\end{document}

答案1

添加条件测试并使用\frontmatterand \mainmatter

\documentclass[12pt,oneside]{memoir}

\title{Document}
\author{prosseek}

% http://tex.stackexchange.com/questions/97465/modify-default-memoir-chapter-style
\makeatletter
\newcommand{\fonttitle}{\chaptitlefont}
\makechapterstyle{mystyle}{%
  \def\chapterheadstart{\vspace*{\beforechapskip}}
  \def\printchaptername{}
  \def\printchapternum{}
  \def\printchapternonum{}
  \def\printchaptertitle##1{%
    \fonttitle \if@mainmatter \thechapter.\space\fi ##1}
  \def\afterchaptertitle{\par\nobreak\vskip \afterchapskip}
}
\makeatother

\chapterstyle{mystyle}

\begin{document}
\frontmatter
\maketitle
\tableofcontents
\mainmatter
\chapter{The Domain Problem and Stakeholders}
\section{First}
abcdef. 

\end{document}

相关内容