删除目录中章节后面的数字

删除目录中章节后面的数字

例如,使用\chapter{INTRODUCTION}将被打印为

1 INTRODUCTION...............x

1我想删除章节后面的数字,因此目录中的输出将是:

INTRODUCTION................x

注意:x是页码。

我的 MWE 是:

\documentclass{a4paper, 12pt, oneside, openany}{book}
\usepackage[a4paper, inner=4cm, outer=3cm, top=4cm, bottom=3cm]{geometry}
\usepackage{blindtext}

\begin{document}

\tableofcontents

\chapter{Chapter 1. INTRODUCTION}
\section{Section Name}
\blindtext
\section{Section Name}
\blindtext
\chapter{Chapter 2. BACKGROUND}
\section{Section Name}
\blindtext
\section{Section Name}
\blindtext

\end{document}

答案1

您可以使用包来影响目录中标题的外观titletoc。这允许您删除数字。

此命令为\titlecontents。请参阅下面代码中的注释,了解此命令的参数描述。另请参阅包装文档

MWE(请注意,我删除了命令的手册“第 n 章”部分\chapter):

\documentclass[a4paper, 12pt, oneside, openany]{book}
\usepackage[a4paper, inner=4cm, outer=3cm, top=4cm, bottom=3cm]{geometry}
\usepackage{blindtext}
\usepackage{titletoc}
\titlecontents{chapter}% redefine chapter toc appearance
[1.5em]% left margin
{}% code before starting the title, here empty
{\hspace*{-2.3em}\bfseries}% format: shift a bit left and boldface, no number
{\hspace*{-2.3em}\bfseries}% format for \chapter*, not really needed for the MWE but added for completeness
{\titlerule*[1pc]{.}\contentspage}% dotted line and page number

\begin{document}

\tableofcontents

\chapter{INTRODUCTION}
\section{Section Name}
\blindtext
\section{Section Name}
\blindtext
\chapter{BACKGROUND}
\section{Section Name}
\blindtext
\section{Section Name}
\blindtext

\end{document}

TOC 中的结果:

在此处输入图片描述

在文档中:

在此处输入图片描述

如果您还想更改文档的外观,那么您可以使用与titlesec密切相关titletoc且语法非常相似的包。更改文档标题的命令是\titleformat。请参阅下面代码中的注释,了解此命令的参数说明。

\documentclass[a4paper, 12pt, oneside, openany]{book}
\usepackage[a4paper, inner=4cm, outer=3cm, top=4cm, bottom=3cm]{geometry}
\usepackage{blindtext}
\usepackage{titlesec}
\usepackage{titletoc}
\titlecontents{chapter}% redefine chapter toc appearance
[1.5em]% left margin
{}% code before starting the title, here empty
{\hspace*{-2.3em}\bfseries}% format: shift a bit left and boldface, no number
{\hspace*{-2.3em}\bfseries}% format for \chapter*, not really needed for the MWE but added for completeness
{\titlerule*[1pc]{.}\contentspage}% dotted line and page number

\titleformat{\chapter}% change format of chapter in the document
{\huge\bfseries}% huge font and bold
{Chapter \thechapter}% the word Chapter followed by the chapter number
{1em}%horizontal space between 'Chapter n' and the chapter title
{}% code after the title, here empty

\begin{document}

\tableofcontents

\chapter{INTRODUCTION}
\section{Section Name}
\blindtext
\section{Section Name}
\blindtext
\chapter{BACKGROUND}
\section{Section Name}
\blindtext
\section{Section Name}
\blindtext

\end{document}

目录相同,但文档中的章节现在如下:

在此处输入图片描述

相关内容