我编写了一个回忆录文档,其中 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
添加条件测试并使用\frontmatter
and \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}