![从回忆录的标题中删除章节编号及其点](https://linux22.com/image/340384/%E4%BB%8E%E5%9B%9E%E5%BF%86%E5%BD%95%E7%9A%84%E6%A0%87%E9%A2%98%E4%B8%AD%E5%88%A0%E9%99%A4%E7%AB%A0%E8%8A%82%E7%BC%96%E5%8F%B7%E5%8F%8A%E5%85%B6%E7%82%B9.png)
我想从标题中删除节号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}