![刪除章節編號,保留章節編號](https://rvso.com/image/330741/%E5%88%AA%E9%99%A4%E7%AB%A0%E7%AF%80%E7%B7%A8%E8%99%9F%EF%BC%8C%E4%BF%9D%E7%95%99%E7%AB%A0%E7%AF%80%E7%B7%A8%E8%99%9F.png)
我不知道如何刪除每章前面的章節編號(Chapter #
),同時保留章節編號。所以我需要類似下面的東西:
章節名稱
1.1 第一節
1.2 第二節
另外,我的照片編號有點奇怪。現在,我有照片 2.1(因為該照片位於第 2 部分)。我只想要正常編號,例如照片 1、照片 2 等。
感謝您的幫忙!
答案1
最簡單的方法是設定\thechapter
為空,即{}
,但這會留下\thesection
尾隨.
,並且章節標題仍將顯示Chapter
(或\chaptername
)。
為了獲得連續的圖形編號,必須將圖形計數器從章節重置清單中踢出,即使用\counterwithout{figure}{chapter}
。然後。
由於問題有點不清楚,所以我\@makechapterhead
現在不改變。
\documentclass{book}
\usepackage{chngcntr}%
\renewcommand{\thechapter}{}%
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}%
\counterwithout{figure}{chapter}
\begin{document}
\tableofcontents
\listoffigures
\chapter{First chapter}
\section{First section}
\begin{figure}
\caption{Dummy figure}
\end{figure}
\chapter{Second chapter}
\section{First section in 2nd chapter}
\begin{figure}
\caption{Another dummy figure}
\end{figure}
\end{document}
答案2
這是一種方法titlesec
(儘管最新版本似乎存在一些問題:我不會用以前版本的 titlesec 完全這樣做):
\documentclass{book}
\usepackage[utf8]{inputenc} \usepackage{titlesec}
\titleformat{\chapter}[block]{\bfseries\Huge}{}{0em}{}
\titleformat{\section}[hang]{\bfseries\Large}{}{1em}{\thesection\enspace}
\begin{document}
\tableofcontents
\listoffigures
\chapter{First chapter}
\section{First section}
\begin{figure}
\caption{Dummy figure}
\end{figure}
\end{document}