刪除「第 n 章」一詞

刪除「第 n 章」一詞

所以我正在努力消除Chapter n,並將其替換為chapter title。但我希望它顯示在目錄中......(所以我不能使用\chapter*{...})。

有辦法實現嗎?

謝謝!

答案1

使用titlesec

\documentclass{book}
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{}{0pt}{\Huge}
\titlespacing*{\chapter} {0pt}{20pt}{40pt}
\begin{document}
  \tableofcontents
  \chapter{Some chapter}
\end{document}

在此輸入影像描述

在此輸入影像描述

答案2

這對我有用:

\chapter*{Introduction}\stepcounter{chapter}\addcontentsline{toc}{chapter}{Introduction}

將該程式碼放在章節的開頭。

答案3

如果您使用bookreportdocument 類,並且不想使用 LaTeX 包,例如titlesec,您可以透過重新定義(實際上是簡化)低階宏 來繼續\@makechapterhead。這是一個使用文檔類別的工作範例book;以 開頭的行%%已從 的原始程式碼中註解掉\@makechapterhead

\documentclass{book}
\makeatletter
\def\@makechapterhead#1{%
  %%\vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    %%\ifnum \c@secnumdepth >\m@ne
      %%\if@mainmatter
      %%  \huge\bfseries \@chapapp\space \thechapter
      %%  \par\nobreak
      %%  \vskip 20\p@
      %%\fi
    %%\fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }}
\makeatother
\begin{document}
\tableofcontents
\mainmatter
\chapter{First}
\chapter{Second}
\end{document}

答案4

在序言中加入這樣一行

\setcounter{secnumdepth}{-1}

相關內容