我正在写博士论文。除了第一条之外,我的目录都很好。我得到的输出如下
Table of contents
Inner page ii
content ii
我想将第一个条目更改为页码 i,如下所示:
Table of contents
inner page i
content ii
我尝试了几种方法,但都不起作用。以下是有效示例。
\documentclass[12pt]{report}
\usepackage{tcolorbox}% http://ctan.org/pkg/tcolorbox
\usepackage{caption}
\usepackage{setspace} % for \onehalfspacing
\usepackage{titlesec}
\usepackage{etoolbox} % package is used for formattig table of content
\begin{document}
\clearpage\thispagestyle{empty}
\include{cover_page}
\pagenumbering{roman}
\clearpage\thispagestyle{empty}
\include{copyrightpage}
\addtocontents{toc}{~\textbf{CHAPTER NO.}\hfill\textbf{TITLE}\hfill\textbf{PAGE NO.}\par}
\addcontentsline{toc}{chapter}{Inner first page}
\addcontentsline{toc}{chapter}{Contents}
\renewcommand{\contentsname}{TABLE OF CONTENTS}
\tableofcontents
\end{document}
封面.tex
\begin{onehalfspace}
\begin{center}
\textbf{\LARGE{}title}{\LARGE{}}\\
\vspace{1cm}
\par\end{center}
\end{onehalfspace}
\begin{center}
\textit{\large{}Thesis submitted in fulfillment of the requirements
for the Degree of}
\par\end{center}{\large \par}
\vspace{1cm}
\begin{center}
\textbf{\Large{}DOCTOR OF PHILOSOPHY}
\par\end{center}{\Large \par}
\vspace{1cm}
\begin{center}
by
\par\end{center}
\vspace{1cm}
\begin{center}
\textbf{\large{}Name\\ Enrollment No. (101)}
\par\end{center}{\large \par}
\vspace{1cm}
\begin{center}
\begin{minipage}[t]{1\columnwidth}%
\begin{center}
\end{center}%
\end{minipage}
\end{center}
\vspace{1cm}
\begin{center}
{\fontsize{12pt}{12pt}Dept}
\par\end{center}
\vspace{0.25cm}
\begin{center}
{\fontsize{12pt}{12pt} UNIVERSITY name
\\ }
\par\end{center}
\vspace{0.5cm}
版权页.tex
~~\\
\vfill
\begin{center}
{\fontsize{10pt}{10pt}@ Copyright }
\end{center}
我已附上我所得到的输出。
请告诉我该怎么做。提前谢谢!
答案1
在您的 MWE 中,这两个命令都在同一页上执行。由于在插入文件后使用了,\addcontentsline
因此此页面是目录的第一页。因此您必须稍微更改一下代码的顺序。\include
\clearpage
\documentclass[12pt]{report}
\AtBeginDocument{%
\addtocontents{toc}{~\textbf{CHAPTER NO.}\hfill\textbf{TITLE}\hfill\textbf{PAGE NO.}\par}%
}
\begin{document}
\clearpage
\thispagestyle{empty}
\include{cover_page}
\clearpage
\pagenumbering{roman}
\thispagestyle{empty}
\addcontentsline{toc}{chapter}{Inner first page}
\include{copyrightpage}
\clearpage
\addcontentsline{toc}{chapter}{Contents}
\renewcommand{\contentsname}{TABLE OF CONTENTS}
\tableofcontents
\end{document}
结果: