我希望我的论文中的目录格式与所附书籍目录图片中的格式相同。我遇到了几个问题:i) 部分编号和名称未居中对齐。ii) 我希望每个部分的章节编号都从 1 开始。iii) 我还想在每个章节名称前添加页面范围。iv) 我希望每个部分的顶部分别显示章节和页面标签。
这是我的代码。
\documentclass[12pt,a4paper]{report}
\usepackage{amsmath, amsthm, amscd,amssymb}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\addto{\captionsenglish}{%
\renewcommand{\bibname}{References}
}
\usepackage[pagestyles, clearempty, explicit,raggedright]{titlesec}
\usepackage{etoolbox}
\makeatletter
\patchcmd\@part
{\thepart\hspace{1em}}
{\MakeUppercase{\partname}\ \thepart\hspace{1em}}
{}{}
\makeatother%must add before hyperref package
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
citecolor=blue,
urlcolor=blue
}
\counterwithin*{chapter}{part}%must add after hyperref package
\usepackage[nottoc]{tocbibind}
\newcommand\cpart[1]{\part[\hfill#1\hfill]{#1}}
\addtocontents{toc}{\textbf{CHAPTERS}\hfill \textbf{PAGES}\par}
\def\topic#1{
\section*{#1}
\addcontentsline{toc}{section}{#1}}
\begin{document}
\pagenumbering{roman}
\tableofcontents
\clearpage
\chapter*{}
\vskip-1in
\topic{Introduction}
Some text here.
\chapter*{}\vskip-1in
\topic{Problem statement}
Some text here.
\clearpage
\pagenumbering{gobble}
\cpart{First Part name}
\setcounter{page}{1}
\renewcommand{\thepage}{\arabic{chapter}.\arabic{page}}
\chapter{First Chapter name}
\section {Section name}
\newpage
\section {Section name}
\chapter{Second Chapter name}
\section {Section name}
\clearpage
\pagenumbering{gobble}
\cpart{Second Part name}
\setcounter{page}{1}
\renewcommand{\thepage}{\arabic{chapter}.\arabic{page}}
\chapter{First Chapter name}
\section {Section name}
\chapter{Second Chapter name}
\section {Section name}
\end{document}