我对章节编号感到困惑...虽然已经开始了新的章节,但每个章节都延续前一章节的编号。
这是一个 MWE
\documentclass[12pt,a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{remreset,siunitx,array,textgreek,booktabs,etoolbox,geometry}
\usepackage{graphicx,wrapfig,lscape,rotating,amsmath}
\geometry{letterpaper}
\sisetup{text-micro=\textmu}
\title{\Huge\textbf{Title}}
\author{di \textbf{Author}}
\date{date}
\makeatletter
\renewcommand \thesection {\@arabic\c@section}
\@removefromreset{section}{chapter}
\makeatother
\begin{document}
\maketitle
\chapter*{C1}
\section{S1.1}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
\section{S1.2}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
\chapter*{C2}
\section{S2.1}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
\section{S2.2}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
\chapter*{C3}
\section{S3.1}
blah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah
我怎么解决这个问题?
答案1
对“作品”进行快速而粗略的重新定义\chapter*
,它会重置其中的部分计数器并使用chapter*
通常的样式。
\documentclass[12pt,a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{remreset,siunitx,array,textgreek,booktabs,etoolbox}
\usepackage{geometry}
\usepackage{graphicx,wrapfig,lscape,rotating,amsmath}
\geometry{letterpaper}
\sisetup{text-micro=\textmu}
\title{\Huge\textbf{Title}}
\author{di \textbf{Author}}
\date{date}
\let\LaTeXStandardChapter\chapter
\makeatletter
\renewcommand{\chapter}{%
\@ifstar{\improvedstarredchapter}{\LaTeXStandardChapter}%
}%
\newcommand{\improvedstarredchapter}[1]{%
\setcounter{section}{0}%
\LaTeXStandardChapter*{#1}%
}%
\makeatother
\makeatletter
\renewcommand \thesection {\@arabic\c@section}
\makeatother
\begin{document}
\maketitle
\chapter*{C1}
\section{S1.1}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
\section{S1.2}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
\chapter*{C2}
\section{S2.1}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
\section{S2.2}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
\chapter*{C3}
\section{S3.1}
blah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah
\end{document}
答案2
如果您想要的只是删除“第 n 章”部分,解决方法非常简单:只需更改为不生成它,最简单的方法是使用找到\@makechapterhead
时使用的相同命令。\chapter*
\documentclass[12pt,a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{siunitx,array,textgreek,booktabs,etoolbox,geometry}
\usepackage{graphicx,wrapfig,lscape,rotating,amsmath}
\sisetup{text-micro=\textmu}
\makeatletter
\let\@makechapterhead\@makeschapterhead
\makeatother
\title{\Huge\textbf{Title}}
\author{di \textbf{Author}}
\date{date}
\begin{document}
\chapter{C1}
\section{S1.1}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
\section{S1.2}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
\chapter{C2}
\section{S2.1}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
\section{S2.2}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
\chapter{C3}
\section{S3.1}
blah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah
\end{document}