\documentclass[12pt,a4paper]{report}
是我的文档类。
章节通常以1
、2
、3
、 …编号。
因此,小节的编号通常为1.1
、1.2
、2.1
、2.2
、2.3
…
按照这种模式,小节的编号通常为1.1.1
,,1.1.2
...
现在,我遇到了以下问题:有一章只有一个小节。因此,我不想对其进行编号,而只是这样写:
\subsection*{Title}
\addcontentsline{toc}{subsection}{Title}
假设这是在章节内2
。如果我现在使用\subsection{Step 1}
,此小节将编号为2.0.1
。但我不希望它以这种方式编号,也不想编号为2.1
。我更希望它编号为1
,,2
…
我怎样才能做到这一点?
编辑:我的完整代码:
\documentclass[12pt,a4paper]{report}
\usepackage[british]{babel}
\usepackage[T3,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
\DisableLigatures[f]{encoding = T1}
\microtypecontext{spacing=nonfrench}
\usepackage{geometry}
\geometry{
left=2cm,
right=2cm,
top=2cm,
bottom=2cm,
bindingoffset=0mm
}
\addto\captionsbritish{% Replace "english" with the language you use
\renewcommand{\contentsname}%
{Table of contents}%
}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
\begin{document}
\begin{titlepage}
\vspace*{2cm}
\centering
{\scshape\LARGE Titlepage \par}
\end{titlepage}
\cleardoublepage
\pagenumbering{Roman}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}
\chapter{One}
This is chapter one.
\section{One dot one}
This is the first section of chapter one.
\subsection{One dot one dot one}
This is the first subsection of chapter one.
\subsection{One dot one dot two}
This is the second subsection of chapter one.
\subsubsection{One dot one dot two dot one}
This is the first subsection of 1.2.
\subsubsection{One dot one dot two dot two}
This is the second subsection of 1.2.
\section{One dot two}
This is the second section of chapter one.
\chapter{Two}
This is chapter two.
\section{Two dot one}
This is the first section of chapter two.
\subsection*{Subsection of chapter two}
\addcontentsline{toc}{subsection}{Subsection of chapter two}
This is the only subsection of chapter two. It, thus, does not have any numbering. But it contains two subsections which I do not want to be numbered in the way as described above.
\subsubsection{Step 1}
This is the first subsection (= subsubsection) of “Subsection of chapter two”.
\subsubsection{Step 2}
This is the second subsection (= subsubsection) of “Subsection of chapter two”.
\section{Two dot two}
This is the second section of chapter two.
\end{document}
请注意,我也在使用
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
现在,我还看到了另一个美学问题,但我不一定需要解决这个问题。在目录中,Subsection of chapter two
与 左对齐。也许最好将 缩进一点,以便它与子小节编号的开头对齐。Two dot one
Subsection of chapter two
答案1
我完全不推荐这样的编号方案,尤其是省略章节编号会让读者感到困惑。
\begingroup
\refstepcounter{subsection}
\renewcommand{\thesubsection}{\arabic{section}.\arabic{subsection}}
\subsection*{Subsection of chapter two}
\addcontentsline{toc}{subsection}{Subsection of chapter two}
This is the only subsection of chapter two. It, thus, does not have any numbering. But it contains two subsections which I do not want to be numbered in the way as described above.
\subsubsection{Step 1}
This is the first subsection (= subsubsection) of “Subsection of chapter two”.
\subsubsection{Step 2}
This is the second subsection (= subsubsection) of “Subsection of chapter two”.
\endgroup
——这将在 TeX 组内改变\thesubsection
,即只要这里需要它,包括两个子部分。
\documentclass[12pt,a4paper]{report}
\usepackage[british]{babel}
\usepackage[T3,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
\DisableLigatures[f]{encoding = T1}
\microtypecontext{spacing=nonfrench}
\usepackage{geometry}
\geometry{
left=2cm,
right=2cm,
top=2cm,
bottom=2cm,
bindingoffset=0mm
}
\addto\captionsbritish{% Replace "english" with the language you use
\renewcommand{\contentsname}%
{Table of contents}%
}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
\begin{document}
\begin{titlepage}
\vspace*{2cm}
\centering
{\scshape\LARGE Titlepage \par}
\end{titlepage}
\cleardoublepage
\pagenumbering{Roman}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}
\chapter{One}
This is chapter one.
\section{One dot one}
This is the first section of chapter one.
\subsection{One dot one dot one}
This is the first subsection of chapter one.
\subsection{One dot one dot two}
This is the second subsection of chapter one.
\subsubsection{One dot one dot two dot one}
This is the first subsection of 1.2.
\subsubsection{One dot one dot two dot two}
This is the second subsection of 1.2.
\section{One dot two}
This is the second section of chapter one.
\chapter{Two}
This is chapter two.
\section{Two dot one}
This is the first section of chapter two.
\begingroup
\refstepcounter{subsection}
\renewcommand{\thesubsection}{\arabic{section}.\arabic{subsection}}
\subsection*{Subsection of chapter two}
\addcontentsline{toc}{subsection}{Subsection of chapter two}
This is the only subsection of chapter two. It, thus, does not have any numbering. But it contains two subsections which I do not want to be numbered in the way as described above.
\subsubsection{Step 1}
This is the first subsection (= subsubsection) of “Subsection of chapter two”.
\subsubsection{Step 2}
This is the second subsection (= subsubsection) of “Subsection of chapter two”.
\endgroup
\section{Two dot two}
This is the second section of chapter two.
\end{document}
答案2
我不确定“单个小节”应该是什么:你可以将某事物细分为两个或多个部分。
如果你坚持的话,这是一种可能性。
\documentclass[12pt,a4paper]{report}
\usepackage[british]{babel}
\usepackage[T3,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
\DisableLigatures[f]{encoding = T1}
\microtypecontext{spacing=nonfrench}
\usepackage{geometry}
\geometry{
left=2cm,
right=2cm,
top=2cm,
bottom=2cm,
bindingoffset=0mm
}
\addto\captionsbritish{% Replace "english" with the language you use
\renewcommand{\contentsname}%
{Table of contents}%
}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
\begin{document}
\begin{titlepage}
\vspace*{2cm}
\centering
{\scshape\LARGE Titlepage \par}
\end{titlepage}
\cleardoublepage
\pagenumbering{Roman}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}
\chapter{One}
This is chapter one.
\section{One dot one}
This is the first section of chapter one.
\subsection{One dot one dot one}
This is the first subsection of chapter one.
\subsection{One dot one dot two}
This is the second subsection of chapter one.
\subsubsection{One dot one dot two dot one}
This is the first subsection of 1.2.
\subsubsection{One dot one dot two dot two}
This is the second subsection of 1.2.
\section{One dot two}
This is the second section of chapter one.
\chapter{Two}
This is chapter two.
\section{Two dot one}
This is the first section of chapter two.
\subsection*{Subsection of chapter two}
\addcontentsline{toc}{subsection}{Subsection of chapter two}
This is the only subsection of chapter two. It, thus, does not have any numbering. But it contains two subsections which I do not want to be numbered in the way as described above.
\subsubsection{Step 1}
This is the first subsection (= subsubsection) of “Subsection of chapter two”.
\subsubsection{Step 2}
This is the second subsection (= subsubsection) of “Subsection of chapter two”.
\section{Two dot two}
This is the second section of chapter two.
\end{document}
请记住,特殊小节的标签应位于标题内:
\specialsubsubsection{Step 1\label{step1}}