目录中的页数相同

目录中的页数相同

我按照这两个问题获取了罗马数字的页面并将这些页面添加到目录中,如何将摘要和致谢页添加到目录中?罗马数字页码

我修改了一些代码并得到

\documentclass[12pt,a4paper]{memoir}

\title{My Thesis Title}
\author{Me, The Author}

% Define the (unnumbered) title page layout here
\newcommand{\mytitlepage}{
\pagenumbering{alph}
\thispagestyle{empty}
\beforepartskip
\begin{center}
\thetitle

\theauthor
\end{center}
\afterpartskip
\newpage
}

% Define the abstract page layout (numbered iii) here
\newcommand{\abstractpage}{
\frontmatter
\setcounter{page}{3}
\pagestyle{plain}
\begin{center}
Abstract: \thetitle
\end{center}

\theabstract
\newpage
}

% Define the abstract page contents here
\newcommand{\theabstract}{
Abstract content goes here.
}

% Define the acknowledgement page layout (numbered ii) here
\newcommand{\acknowledgementpage}{
\frontmatter
\setcounter{page}{2}
\pagestyle{plain}
\begin{center}
Acknowledgement
\end{center}
}

\begin{document}
\mytitlepage
\acknowledgementpage
\addcontentsline{toc}{chapter}{\numberline{}ACKNOWLEDGEMENT}%
\abstractpage
\addcontentsline{toc}{chapter}{\numberline{}ABSTRACT}%
\tableofcontents*
\addcontentsline{toc}{chapter}{\numberline{}TABLE OF CONTENTS}%
\mainmatter
\chapter{One}
This is chapter 1.
\end{document}

我假设致谢、摘要和目录的页数分别为 ii、iii、iv,但是,我得到的是 ii、iv、iv。

对于这个问题有什么想法吗?

谢谢。

答案1

通过在页面布局定义中放置 \addcontentsline 命令可以解决此问题:

\documentclass[12pt,a4paper]{memoir}

\title{My Thesis Title}
\author{Me, The Author}

% Define the (unnumbered) title page layout here
\newcommand{\mytitlepage}{
\pagenumbering{alph}
\thispagestyle{empty}
\beforepartskip
\begin{center}
\thetitle

\theauthor
\end{center}
\afterpartskip
\newpage
}

% Define the acknowledgement page layout (numbered ii) here
\newcommand{\acknowledgementpage}{
    \frontmatter
    \addcontentsline{toc}{chapter}{\numberline{}ACKNOWLEDGEMENT}%
    \setcounter{page}{2}
\pagestyle{plain}
\begin{center}
    Acknowledgement
\end{center}
}



% Define the abstract page contents here
\newcommand{\theabstract}{
    Abstract content goes here.
}

% Define the abstract page layout (numbered iii) here
\newcommand{\abstractpage}{
\frontmatter
\addcontentsline{toc}{chapter}{\numberline{}ABSTRACT}%
\setcounter{page}{3}
\pagestyle{plain}
\begin{center}
Abstract: \thetitle
\end{center}

\theabstract
\newpage
}

\begin{document}
\mytitlepage
\acknowledgementpage
\abstractpage
\addcontentsline{toc}{chapter}{\numberline{}TABLE OF CONTENTS}%
\tableofcontents*
\mainmatter
\chapter{One}
This is chapter 1.
\end{document}

得出

新目录的图片

相关内容