我正在尝试按照大学要求格式化论文。大学要求前言符合以下要求:
- 目录之前的所有内容都有罗马页码(但不显示在标题页上)
- 目录包括标题页、摘要和目录的条目,并列出了它们的罗马页码。
我似乎无法正确理解这两件事。以下是 MWE:
\documentclass[12pt,letterpaper]{report}
%for split boxes and title page
\usepackage{array}
%for title page
\usepackage{graphicx}
%for double spacing in abstract
\usepackage{setspace}
\usepackage{filecontents}
\begin{filecontents}{title.tex}
\begin{titlepage}
\begin{center}
\vspace*{1in}
\MakeUppercase{The Title of}\\[12pt]
\MakeUppercase{My Thesis}\\
% ----------------------------------------------------------------
\vspace{1.5cm}
by\\[12pt]
Nathan G. Glenn\\[14pt]
% ----------------------------------------------------------------
\vspace{2cm}
Submitted to Brigham Young University in partial fulfillment of\\[12pt] graduation requirements for University Honors \\[5pt]
\vfill
% ----------------------------------------------------------------
Linguistics Department\\[12pt]
Some University\\[12pt]
{November 2012}
\vfill
\begin{tabbing}%
\hspace{3in}\= \kill % set up one tab position
\centering\arraybackslash Advisor: My Advisor \> Honors Representative: My Rep\\[12pt]
\centering\arraybackslash Signature: \hspace{0.5cm}\makebox[1.8in]{\hrulefill} \> Signature: \hspace{0.5cm} \makebox[1.8in]{\hrulefill}
\end{tabbing}
\end{center}
\end{titlepage}
\end{filecontents}
\begin{filecontents}{abstract.tex}
\begin{center}
\vspace*{1in}
ABSTRACT\\[36pt]
\MakeUppercase{The Title of}\\[12pt]
\MakeUppercase{My Thesis}\\[36pt]
Nathan G. Glenn\\[12pt]
Linguistics Department\\[12pt]
Bachelor of Arts\\[36pt]
\end{center}
\doublespacing
Is the page number roman like it should be?
\singlespacing
\end{filecontents}
\begin{document}
\pagenumbering{roman}
\input{title.tex}
\clearpage
\pagenumbering{arabic}
\input{Abstract}
\clearpage
\tableofcontents
\chapter{Title and Abstract Should Appear Above Me in the ToC}
\chapter{Introduction}
\chapter{LitReview}
\end{document}
如果您编译此内容,您会发现我未能让前言使用罗马字母,我甚至没有尝试将前言项目添加到目录中,因为我不知道该怎么做。有人能告诉我如何正确地做到这一点吗?
答案1
以下内容似乎符合您的要求(与 Guido 的回答略有不同):
\documentclass[12pt,letterpaper]{report}
%for split boxes and title page
\usepackage{array}% http://ctan.org/pkg/array
%for title page
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
%for double spacing in abstract
\usepackage{setspace}% http://ctan.org/pkg/setspace
\begin{document}
\pagenumbering{roman}
\thispagestyle{empty}
% --- begin title.tex
%\begin{titlepage}
\addcontentsline{toc}{chapter}{\protect\numberline{}The title of my thesis}% Add title to ToC
\begin{center}
\vspace*{1in}
\MakeUppercase{The Title of}\\[12pt]
\MakeUppercase{My Thesis}\\
% ----------------------------------------------------------------
\vspace{1.5cm}
by\\[12pt]
Nathan G. Glenn\\[14pt]
% ----------------------------------------------------------------
\vspace{2cm}
Submitted to Brigham Young University in partial fulfillment of\\[12pt] graduation requirements for University Honors \\[5pt]
\vfill
% ----------------------------------------------------------------
Linguistics Department\\[12pt]
Some University\\[12pt]
{November 2012}
\vfill
\begin{tabbing}%
\hspace{3in}\= \kill % set up one tab position
\centering\arraybackslash Advisor: My Advisor \> Honors Representative: My Rep\\[12pt]
\centering\arraybackslash Signature: \hspace{0.5cm}\makebox[1.8in]{\hrulefill} \> Signature: \hspace{0.5cm} \makebox[1.8in]{\hrulefill}
\end{tabbing}
\end{center}
%\end{titlepage}
% --- end title.tex
\clearpage
% --- begin abstract.tex
\begin{center}
\vspace*{1in}
ABSTRACT\\[36pt]
\addcontentsline{toc}{chapter}{\protect\numberline{}My abstract}% Add abstract to ToC
\MakeUppercase{The Title of}\\[12pt]
\MakeUppercase{My Thesis}\\[36pt]
Nathan G. Glenn\\[12pt]
Linguistics Department\\[12pt]
Bachelor of Arts\\[36pt]
\end{center}
\doublespacing
Is the page number arabic like it should be?
\singlespacing
% --- end abstract.tex
\clearpage
\pagenumbering{arabic}
{
\makeatletter
\let\@oldstarttoc\@starttoc
\renewcommand{\@starttoc}{%
\addcontentsline{toc}{chapter}{\protect\numberline{}\contentsname}% Add ToC to ToC
\@oldstarttoc
}
\tableofcontents
\makeatother
}
\chapter{Title and Abstract Should Appear Above Me in the ToC}
\chapter{Introduction}
\chapter{LitReview}
\end{document}
我没有使用环境,而是titlepage
使用了\pagenumbering{roman}
和\thispagestyle{empty}
来删除页码。对于标题、摘要和内容,我添加了 ,\addtocontents{toc}{chapter}{...}
它将目录中的条目设置为与章节的条目类似。当然,这可以更改。
另外,不要加载etoolbox
包裹和修补\tableofcontents
,的局部重新定义\@starttoc
足以将 ToC 添加到 ToC 本身。
答案2
您必须移动\pagenumbering{arabic}
之后\tableofcontents
,否则摘要和目录的页码将采用阿拉伯数字而不是罗马数字。
\addtocounter{page}{1}
最后,你可以在后面添加一行\end{titlepage}
(titlepage
将末尾页面的计数器重置为 1,因此其后的一页就是第 1 页)>
要将标题页和摘要添加到内容中,您可以添加以下行
\addcontentsline{toc}{chapter}{<TEXT>}
标题页文件和摘要文件开头的某个位置。请<TEXT>
根据上下文替换任何适当的内容。
对于目录,你可以使用etoolbox
包来修补它
\usepackage{etoolbox}
\patchcmd{\tableofcontents}
{\@starttoc}
{\addcontentsline{toc}{chapter}{\contentsname}\@starttoc}
{}
{}
答案3
尝试这个:
\documentclass[12pt,letterpaper]{report}
%for split boxes and title page
\usepackage{array}
%for title page
\usepackage{graphicx}
%for double spacing in abstract
\usepackage{setspace}
\usepackage{filecontents}
\begin{filecontents}{title.tex}
\thispagestyle{empty}
\begin{center}
\vspace*{1in}
\MakeUppercase{The Title of}\\[12pt]
\MakeUppercase{My Thesis}\\
\end{center}
\end{filecontents}
\begin{filecontents}{abstract.tex}
\begin{center}
\vspace*{1in}
\chapter*{ABSTRACT}
\MakeUppercase{The Title of}\\[12pt]
\MakeUppercase{My Thesis}\\[36pt]
Nathan G. Glenn\\[12pt]
Linguistics Department\\[12pt]
Bachelor of Arts\\[36pt]
\end{center}
\doublespacing
Is the page number arabic like it should be?
\singlespacing
\end{filecontents}
\newenvironment{romanpages}
{\setcounter{page}{1}\renewcommand{\thepage}{\roman{page}}}
{\cleardoublepage\renewcommand{\thepage}{\arabic{page}}\setcounter{page}{1}}
\begin{document}
\begin{romanpages}
\input{title}
\addcontentsline{toc}{chapter}{Title}
\input{abstract}
\addcontentsline{toc}{chapter}{Abstract}
\end{romanpages}
\pagenumbering{arabic}
\setcounter{page}{1}
\tableofcontents
\chapter{Title and Abstract Should Appear Above Me in the ToC}
\chapter{Introduction}
\chapter{LitReview}
\end{document}
我添加了一个名为罗马页面的新环境。此外,我还添加了\addcontentsline
包含标题和摘要的命令。此外,还添加了\thispagestyle{empty}
隐藏title.tex
页码的命令。