我很难调整论文前言的页码。我下载了给出的论文模板这里,它使用 book 类作为新定义类 的基础Thesis.cls
。为了编译下面的 MWE,您还需要我提供的链接中的vector.sty
和lstpatch.sty
文件(除非我认为有必要将它们复制并粘贴到问题正文中)。省去细节,我的类文档看起来像这样:
\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesClass{Thesis}
[2007/22/02 v1.0
LaTeX document class]
\def\baseclass{book}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\baseclass}}
\def\@checkoptions#1#2{
\edef\@curroptions{\@ptionlist{\@currname.\@currext}}
\@tempswafalse
\@tfor\@this:=#2\do{
\@expandtwoargs\in@{,\@this,}{,\@curroptions,}
\ifin@ \@tempswatrue \@break@tfor \fi}
\let\@this\@empty
\if@tempswa \else \PassOptionsToClass{#1}{\baseclass}\fi
}
\@checkoptions{11pt}{{10pt}{11pt}{12pt}}
\PassOptionsToClass{a4paper}{\baseclass}
\ProcessOptions\relax
\LoadClass{\baseclass}
\newcommand\bhrule{\typeout{------------------------------------------------------------------------------}}
\newcommand\Declaration[1]{
\btypeout{Approval of the Dissertation Committee}
\addtotoc{Approval of the Dissertation Committee}
\thispagestyle{plain}
\null\vfil
%\vskip 60\p@
\begin{center}{\huge\bf Approval of the Dissertation Committee\par}\end{center}
%\vskip 60\p@
{\normalsize #1}
\vfil\vfil\null
%\cleardoublepage
}
\newcommand\btypeout[1]{\bhrule\typeout{\space #1}\bhrule}
\def\today{\ifcase\month\or
January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi
\space \number\year}
\usepackage{setspace}
\onehalfspacing
\setlength{\parindent}{0pt}
\setlength{\parskip}{2.0ex plus0.5ex minus0.2ex}
\usepackage{vmargin}
\setmarginsrb { 1.5in} % left margin
{ 0.6in} % top margin
{ 1.0in} % right margin
{ 0.8in} % bottom margin
{ 20pt} % head height
{0.25in} % head sep
{ 9pt} % foot height
{ 0.3in} % foot sep
\raggedbottom
\setlength{\topskip}{1\topskip \@plus 5\p@}
\doublehyphendemerits=10000 % No consecutive line hyphens.
\brokenpenalty=10000 % No broken words across columns/pages.
\widowpenalty=9999 % Almost no widows at bottom of page.
\clubpenalty=9999 % Almost no orphans at top of page.
\interfootnotelinepenalty=9999 % Almost never break footnotes.
\usepackage{fancyhdr}
\lhead[\rm\thepage]{\fancyplain{}{\sl{\rightmark}}}
\rhead[\fancyplain{}{\sl{\leftmark}}]{\rm\thepage}
\chead{}\lfoot{}\rfoot{}\cfoot{}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\btypeout{\thechapter\space #1}\markboth{\@chapapp\ \thechapter\ #1}{\@chapapp\ \thechapter\ #1}}
\renewcommand{\sectionmark}[1]{}
\renewcommand{\subsectionmark}[1]{}
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\usepackage{amsmath,amsfonts,amssymb,amscd,amsthm,xspace}
\theoremstyle{plain}
\newtheorem{example}{Example}[chapter]
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{axiom}[theorem]{Axiom}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
\usepackage[centerlast,small,sc]{caption}
\setlength{\captionmargin}{20pt}
\newcommand{\fref}[1]{Figure~\ref{#1}}
\newcommand{\tref}[1]{Table~\ref{#1}}
\newcommand{\eref}[1]{Equation~\ref{#1}}
\newcommand{\cref}[1]{Chapter~\ref{#1}}
\newcommand{\sref}[1]{Section~\ref{#1}}
\newcommand{\aref}[1]{Appendix~\ref{#1}}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{.85}
\renewcommand{\textfraction}{0.1}
\renewcommand{\dbltopfraction}{.85}
\renewcommand{\floatpagefraction}{0.75}
\renewcommand{\dblfloatpagefraction}{.75}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage[scriptsize]{subfigure}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{listings}
\usepackage{lstpatch}
\lstset{captionpos=b,
frame=tb,
basicstyle=\scriptsize\ttfamily,
showstringspaces=false,
keepspaces=true}
\lstdefinestyle{matlab} {
language=Matlab,
keywordstyle=\color{blue},
commentstyle=\color[rgb]{0.13,0.55,0.13}\em,
stringstyle=\color[rgb]{0.7,0,0} }
\usepackage[pdfpagemode={UseOutlines},bookmarks=true,bookmarksopen=true,
bookmarksopenlevel=0,bookmarksnumbered=true,hypertexnames=false,
colorlinks,linkcolor={blue},citecolor={blue},urlcolor={red},
pdfstartview={FitV},unicode,breaklinks=true]{hyperref}
\pdfstringdefDisableCommands{
\let\\\space
}
\newcommand*{\supervisor}[1]{\def\supname{#1}}
\newcommand*{\examiner}[1]{\def\examname{#1}}
\newcommand*{\degree}[1]{\def\degreename{#1}}
\newcommand*{\authors}[1]{\def\authornames{#1}}
\newcommand*{\addresses}[1]{\def\addressnames{#1}}
\newcommand*{\university}[1]{\def\univname{#1}}
\newcommand*{\UNIVERSITY}[1]{\def\UNIVNAME{#1}}
\newcommand*{\department}[1]{\def\deptname{#1}}
\newcommand*{\DEPARTMENT}[1]{\def\DEPTNAME{#1}}
\newcommand*{\group}[1]{\def\groupname{#1}}
\newcommand*{\GROUP}[1]{\def\GROUPNAME{#1}}
\newcommand*{\faculty}[1]{\def\facname{#1}}
\newcommand*{\FACULTY}[1]{\def\FACNAME{#1}}
\newcommand*{\subject}[1]{\def\subjectname{#1}}
\newcommand*{\keywords}[1]{\def\keywordnames{#1}}
\supervisor {Dr. Such and Such}
\examiner {}
\degree {}
\authors {MEEE!!}
\university {\texorpdfstring{\href{}
{Real Good University}}
{Real Good University}}
\UNIVERSITY {\texorpdfstring{\href{}
{REAL GOOD UNIVERSITY}}
{REAL GOOD UNIVERSITY}}
\department {\texorpdfstring{\href{}
{Department of Fizzx}}
{Department of Fizzx}}
\DEPARTMENT {\texorpdfstring{\href{}
{DEPARTMENT OF FIZZX}}
{DEPARTMENT OF FIZZX}}
\group {\texorpdfstring{\href{Research Group Web Site URL Here (include http://)}
{Research Group Name}}
{Research Group Name}}
\GROUP {\texorpdfstring{\href{Research Group Web Site URL Here (include http://)}
{RESEARCH GROUP NAME (IN BLOCK CAPITALS)}}
{RESEARCH GROUP NAME (IN BLOCK CAPITALS)}}
\faculty {\texorpdfstring{\href{Faculty Web Site URL Here (include http://)}
{Faculty Name}}
{Faculty Name}}
\FACULTY {\texorpdfstring{\href{Faculty Web Site URL Here (include http://)}
{FACULTY NAME (IN BLOCK CAPITALS)}}
{FACULTY NAME (IN BLOCK CAPITALS)}}
\addresses {}
\subject {}
\keywords {}
\renewcommand\maketitle{
\btypeout{Title Page}
\hypersetup{pdftitle={\@title}}
\hypersetup{pdfsubject=\subjectname}
\hypersetup{pdfauthor=\authornames}
\hypersetup{pdfkeywords=\keywordnames}
\thispagestyle{empty}
\begin{titlepage}
\let\footnotesize\small
\let\footnoterule\relax
\let \footnote \thanks
\setcounter{footnote}{1}
\null\vfil
\vskip 60\p@
\begin{center}
\setlength{\parskip}{0pt}
%{\large\textbf{Claremont Graduate University}\par}
\vfill
{\huge \bf \@title \par}
\vfill
{\LARGE by \par}
\smallskip
{\LARGE \authornames \par}
\vfill
{\large A thesis submitted in partial fulfillment for the \par}
{\large degree of Doctor of Philosophy in Mathematics \par}
\bigskip
\bigskip
{\large in the \par}
%{\large \facname \par}
{\large \deptname \par}
{\large \univname \par}
\bigskip
\bigskip
\bigskip
{\Large \@date \par}
\bigskip
\end{center}
\par
\@thanks
\vfil\null
\end{titlepage}
\setcounter{footnote}{0}%
\global\let\thanks\relax
\global\let\maketitle\relax
\global\let\@thanks\@empty
\global\let\@author\@empty
\global\let\@date\@empty
\global\let\@title\@empty
\global\let\title\relax
\global\let\author\relax
\global\let\date\relax
\global\let\and\relax
\cleardoublepage
}
\newenvironment{abstract}
{
\btypeout{Abstract Page}
\thispagestyle{empty}
\null\vfil
\begin{center}
\setlength{\parskip}{0pt}
{\huge{\textit{Abstract}} \par}
\bigskip
{\normalsize\bf A Pretty Decent(?) Thesis \par}
\medskip
{\normalsize by \par}
{\normalsize \authornames \par}
\bigskip
{\normalsize \UNIVNAME : 2019 \par}
\bigskip
% {\normalsize \facname \par}
% {\normalsize \deptname \par}
% \bigskip
% {\normalsize Doctor of Philosophy\par}
%\bigskip
\end{center}
}
{
\vfil\vfil\vfil\null
\cleardoublepage
}
\addtocounter{secnumdepth}{1}
\setcounter{tocdepth}{6}
\newcounter{dummy}
\newcommand\addtotoc[1]{
\refstepcounter{dummy}
\addcontentsline{toc}{chapter}{#1}}
\renewcommand\tableofcontents{
\btypeout{Table of Contents}
\begin{spacing}{1}{
\setlength{\parskip}{1pt}
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\contentsname
\@mkboth{
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
\@starttoc{toc}
\if@restonecol\twocolumn\fi
\cleardoublepage
}\end{spacing}
}
\renewcommand\listoffigures{
\btypeout{List of Figures}
\addtotoc{List of Figures}
\begin{spacing}{1}{
\setlength{\parskip}{1pt}
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\listfigurename
\@mkboth{\MakeUppercase\listfigurename}
{\MakeUppercase\listfigurename}}
\@starttoc{lof}
\if@restonecol\twocolumn\fi
\cleardoublepage
}\end{spacing}
}
\renewcommand\listoftables{
\btypeout{List of Tables}
\addtotoc{List of Tables}
\begin{spacing}{1}{
\setlength{\parskip}{1pt}
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\listtablename
\@mkboth{
\MakeUppercase\listtablename}{\MakeUppercase\listtablename}}
\@starttoc{lot}
\if@restonecol\twocolumn\fi
\cleardoublepage
}\end{spacing}
}
\newcommand\listsymbolname{Abbreviations}
\usepackage{longtable}
\newcommand\listofsymbols[2]{
\btypeout{\listsymbolname}
\addtotoc{\listsymbolname}
\chapter*{\listsymbolname
\@mkboth{
\MakeUppercase\listsymbolname}{\MakeUppercase\listsymbolname}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
\cleardoublepage
}
\newcommand\listconstants{Physical Constants}
\usepackage{longtable}
\newcommand\listofconstants[2]{
\btypeout{\listconstants}
\addtotoc{\listconstants}
\chapter*{\listconstants
\@mkboth{
\MakeUppercase\listconstants}{\MakeUppercase\listconstants}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
\cleardoublepage
}
\newcommand\listnomenclature{Symbols}
\usepackage{longtable}
\newcommand\listofnomenclature[2]{
\btypeout{\listnomenclature}
\addtotoc{\listnomenclature}
\chapter*{\listnomenclature
\@mkboth{
\MakeUppercase\listnomenclature}{\MakeUppercase\listnomenclature}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
\cleardoublepage
}
\newcommand\acknowledgements[1]{
\btypeout{Acknowledgements}
\addtotoc{Acknowledgements}
\thispagestyle{plain}
\begin{center}{\huge{\textit{Acknowledgements}} \par}\end{center}
{\normalsize #1}
\vfil\vfil\null
}
\newcommand\dedicatory[1]{
\btypeout{Dedicatory}
\thispagestyle{plain}
\null\vfil
\vskip 60\p@
\begin{center}{\Large \sl #1}\end{center}
\vfil\null
\cleardoublepage
}
\renewcommand\backmatter{
\if@openright
\cleardoublepage
\else
\clearpage
\fi
\addtotoc{\bibname}
\btypeout{\bibname}
\@mainmatterfalse}
\endinput
我还包括了一个用于编译的 MWE:
\documentclass[a4paper, 11pt, oneside]{Thesis}
\begin{document}
\setstretch{1.3}
\fancyhead{}
\rhead{} %\thepage}
\lhead{}
\pagestyle{empty}
\frontmatter
\title {A Pretty Decent(?) Thesis}
\authors {Me}
\maketitle
%% ----------------------------------------------------------------
% The "Funny Quote Page"
\pagestyle{empty} % No headers or footers for the following pages
\null\vfill
\begin{flushright}
Ha! A limerick\\
The bane of my existence\\
Thank goodness I'm done
\end{flushright}
\vfill\vfill\vfill\vfill\vfill\vfill\null
\clearpage % Funny Quote page ended, start a new page
\addtotoc{Abstract} % Add the "Abstract" page entry to the Contents
\abstract{
\addtocontents{toc}{\vspace{1em}}
It's a pretty good thesis, I promise.
}
\clearpage
\setstretch{1.3}
\pagestyle{fancy}
\acknowledgements{
\addtocontents{toc}{\vspace{1em}}
Thank you, I love you, Babye.
}
\pagestyle{fancy}
\lhead{\emph{Contents}}
\tableofcontents
\lhead{\emph{List of Figures}}
\listoffigures
\end{document}
我看到的主要问题可以从第 4 个编译页(致谢)中得到说明,我们可以看到这是文档中的第 4 页,但它被列为第 iii 页:
我想要两件事:
- 我希望罗马数字编号从标题页开始(即 pdf 的第一页应该是第 i 页)。
- 我不希望前言编号在致谢部分之前可见。
我的 MWE 并不完美,因为 MWE 中显示的第一个页码位于致谢页,而在我的实际论文中,摘要的页码i
印在底部。我不确定如何使我的 MWE 更全面,但我希望我可以一次解决这些问题,即使不能同时解决。
答案1
好的,让我们从可编译的代码开始来解释您的问题fancyhdr
。
使用以下代码模拟你的论文结构
\documentclass[a4paper, 11pt, oneside]{book}
\usepackage{fancyhdr}
\usepackage{blindtext}
\title{A Pretty Decent Thesis}
\author{username}
\begin{document}
\frontmatter
%\pagestyle{empty} % <===================================================
\maketitle
\section*{Abstract}
\Blindtext
\tableofcontents
\listoffigures
\pagestyle{fancy} % <===================================================
\mainmatter
\chapter{Introduction}
\Blinddocument
\end{document}
你可以看到这两行\pagestyle
很重要。如果你编译上面的代码,你会得到
您可以在那里看到两件事:显示页码(因为第一个\pagestyle{empty}
被注释了!)并且它使用罗马数字,如您在底部的红色圆圈中所见。根据您的 pdf 查看器,pdf 查看器会完全使用阿拉伯数字对页面进行编号(在您和我的情况下都是如此)。这意味着前几页(在打印时用罗马数字编号直到iv
)是用阿拉伯数字计算的。您可以在编译我的代码后在最后一页看到这一点。最后一页的打印页码为 20,但在查看器中算作第 25 页。此行为取决于使用的查看器。据我所知,Acrobat 显示罗马数字和阿拉伯数字。
现在请取消注释第一个\pagestyle{empty}
。现在fancyhdr
知道它不必在所有后续页面上显示页眉和页脚(直到\pagestyle{fancy}
或另一个命令(如\tableofcontents
使用样式)激活我在此示例代码中使用的plain
标准页眉和页脚)。fancyhdr
编译后,您会得到一些没有页码的页面,但目录仍然显示罗马页码。要摆脱这种情况,您必须调用\thispagestyle{empty}
,因为命令是使用我们不想要的\tableofcontents
样式构建的。同样的情况也可能发生!plain
listoffigures
因此下面的代码
\documentclass[a4paper, 11pt, oneside]{book}
\usepackage{fancyhdr}
\usepackage{blindtext}
\title{A Pretty Decent Thesis}
\author{username}
\pagestyle{plain}{%
\fancyhead{}
\fancyfoot[c]{}
}
\begin{document}
\frontmatter
\pagestyle{empty} % <===================================================
\maketitle
\pagestyle{empty}
\section*{Abstract}
\Blindtext
\tableofcontents
\thispagestyle{empty} % <==============================================
\listoffigures
\thispagestyle{empty} % <==============================================
\pagestyle{fancy} % <===================================================
\mainmatter
\chapter{Introduction}
\Blinddocument
\end{document}
在前言中不显示页码,但显示从第 1 章开始的页码:
现在您可以使用这里解释的命令并在您的论文中使用它们来摆脱不需要的页码。
如果你加载hyperref
你的代码这取决于使用的 pdf 查看器显示的页面是如何编号的。就我而言——我使用的是 SumatraPDF——然后我得到以下屏幕:
现在 SumatraPDF 可以显示我们位于第iii
4 页(阿拉伯数字)。原因是hyperref
激活书签时会携带此信息。
更新:
您正在使用的类有一些错误,其中一个错误导致标题页后面的页面编号错误,即您添加了打油诗的页面。
为了消除此错误,请在序言中(之前\begin{document}
)添加以下代码来定义一个新环境,其中我明确将页码设置为 2(参见标记行<==========
):
\newenvironment{funyquote}
{
\btypeout{Funyquote Page}
\thispagestyle{empty}
\setcounter{page}{2}% <===============================================
\null\vspace{3cm}
}
{
% \vfill\vfill\vfill\vfill\vfill\vfill\null
\cleardoublepage
}
您可以在\maketitle
以下代码后添加带有 limerick 的页面(当然要删除带有 limerick 的旧代码!):
\clearpage
\funyquote{% <==========================================================
\begin{flushright}
Ha! A limerick\\
The bane of my existence\\
Thank goodness I'm done
\end{flushright}
} % <===================================================================
\clearpage % Funny Quote page ended, start a new page
然后你得到结果:
如果不进行上述修正,您将得到错误的页码,从而导致出现以下问题:
我没有调查这个问题从何而来(隐藏在该类代码的某个地方),但我建议使用标准类。谁知道还会出现哪些其他错误……