我正在写论文,编译后,我可以在目录页中看到章节(子章节和子子章节)的编号,但在实际正文中看不到任何编号。它们应该在那里,我不明白为什么。
我如何获取正文中的章节编号?
前言:
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[margin=2cm]{geometry}
\usepackage{graphicx}
\usepackage{siunitx}
\usepackage[usenames, dvipsnames]{color}
\usepackage[round]{natbib}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[RE,RO]{}%\textsl{\rightmark}}
%%\fancyhead[LO,LE]{\textsl{\leftmark}}
\fancyhead[LE,LO]{\textsl{\rightmark}}
\usepackage[section]{placeins}
\usepackage{subfig}
\usepackage{array}
\usepackage{float}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{siunitx}
\usepackage{mathtools}
\usepackage{upgreek}
\usepackage{caption}
\usepackage{lmodern}
\usepackage{array,ragged2e}
\usepackage{pdflscape}
%\usepackage{subcaption}
\usepackage{titlesec}
%%\usepackage{hyperref}
\usepackage[toc,page]{appendix}
\usepackage{multirow}
\usepackage[super]{nth}
\usepackage[margin=0.5cm]{caption}
%,labelfont=bf,font=small
\titleformat
{\chapter} % command
[display] % shape
{\bfseries\huge\sc} % format
{{\begin{center}\Huge Chapter\ \thechapter\end{center}}} % label
{0.5ex} % sep
{
\rule{\textwidth}{1pt}
\vspace{-0.6ex}
\centering
} % before-code
[
\vspace{-1.0ex}%
\rule{\textwidth}{1pt}
] % after-code
\titleformat
{\section} % command
[hang] % shape
{\bfseries\Large\sc\raggedright} % format
{\thesection} % label
{1em} % sep
{} % before commands
[\rule{\textwidth}{0.5pt}] % after commands (optional, remove square braces entirely to set as nothing)
\titleformat
{\subsection} % command
[hang] % shape
{\large\sc\raggedright} % format
{\thesubsection} % label
{1em} % sep
{}
\titleformat
{\subsubsection} % command
[hang] % shape
{\large\sc\raggedright} % format
{\thesubsubsection} % label
{1em} % sep
{}
\titleformat
{\paragraph} % command
[hang] % shape
{\large\sc\raggedright} % format
{\theparagraph} % label
{1em} % sep
{}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
\begin{document}
\pagenumbering{roman}
\tableofcontents
\newpage
\addcontentsline{toc}{chapter}{List of Tables}
\listoftables
\newpage
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures
\chapter{Introduction} \label{c1}
\pagenumbering{arabic}
\section{The first section}
\subsection{The first subsection}
\bibliographystyle{plainnat}
\newpage
\addcontentsline{toc}{chapter}{Bibliography}
\bibliography{bib}
\end{document}