从回忆录的标题中删除章节编号及其点

从回忆录的标题中删除章节编号及其点

我想从标题中删除节号memoir。我使用了下面的代码,它可以工作,但它在节名前面仍然有一个麻烦的点。如何删除它?

\documentclass[a4paper,11pt,twoside]{memoir}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}

\renewcommand{\thesection}{}
\renewcommand{\thesubsection}{\arabic{section}.\arabic{subsection}}
\makeatletter
\def\@seccntformat#1{\csname #1ignore\expandafter\endcsname\csname the#1\endcsname\quad}
\let\sectionignore\@gobbletwo
\let\latex@numberline\numberline
\def\numberline#1{\if\relax#1\relax\else\latex@numberline{#1}\fi}
\makeatother

\begin{document}

\begin{KeepFromToc}
\tableofcontents
\end{KeepFromToc}

\chapter{First chapter}
\lipsum[1]
\section{First section}
\lipsum[2-4]
\section{Second section}
\lipsum[5-8]

\end{document}

答案1

我相信你可以做得更简单:

\documentclass[a4paper,11pt,twoside]{memoir}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}

\setsecnumdepth{chapter}

\begin{document}

\tableofcontents

\chapter{First chapter}
\lipsum[1]
\section{First section}
\lipsum[2-4]
\section{Second section}
\lipsum[5-8]

\end{document}

相关内容