![目录和引言章节存在问题](https://linux22.com/image/330455/%E7%9B%AE%E5%BD%95%E5%92%8C%E5%BC%95%E8%A8%80%E7%AB%A0%E8%8A%82%E5%AD%98%E5%9C%A8%E9%97%AE%E9%A2%98.png)
我目前正在用 tex 写我的硕士论文。我被困在以下地方。首先,我有一章名为“简介”,但未编号。在目录页中,简介页的页码不是 1。例如:
下一个问题出现在介绍章节中。标题与预期不同。在我的模板中,章节的第一页只有一个带有页码的标题行,而后续页面的标题为章节名称。在这种情况下,它会产生其他问题。例如
如何解决这个问题?
第三个问题出现在目录中,如图所示,“致谢”和“摘要”已分配了一些罗马数字。但实际上,相应的 tex 文件中没有页码。如何为这两页设置页码并将其合并到目录中。我还在主文件 thesis.tex 中附加了我的代码,以便它有所帮助:
\documentclass[oneside,a4paper,12pt]{book}
% Start Global Settings
\linespread{1.3}
%\usepackage{epigraph}
\usepackage{attrib}
\usepackage{amssymb}
\usepackage{amsmath}
%\usepackage{abstract}
\usepackage{amsthm}
\usepackage{mathrsfs}
\usepackage{float}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsfonts}
\usepackage{geometry}
\usepackage{braket}
\usepackage{array,booktabs}
\usepackage[dvipsnames]{xcolor}
%\usepackage[svgnames]{xcolor}
\usepackage{sectsty}
\usepackage[titletoc]{appendix}
%\usepackage{nath}
%\usepackage{w}
%\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
%use color for the document
\usepackage{color}
%for allowing word-wrap around images.
\usepackage{floatflt}
\usepackage{graphicx}
\usepackage{fontspec}
%\usepackage{xunicode}
%\usepackage{xltxtra}
\usepackage{polyglossia}
\setmainlanguage[variant=british]{english}
\setotherlanguage{sanskrit}
%\font\serif="FreeSerif:script=beng"
\newfontfamily\devanagarifont[Script=Devanagari]{Lohit Devanagari}
\usepackage{subfigure}
%Indent the first line of the first paragraph after each section heading.
\usepackage{indentfirst}
%Enable HyperLinks
\usepackage[plainpages=false]{hyperref}
\hypersetup{colorlinks,citecolor=black,filecolor=black,linkcolor=black,urlcolor=black}
\usepackage{url}
\usepackage{amsmath}
\setcounter{secnumdepth}{4} %By doing this, we allow subsubsubsections to be numbered :)
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancypagestyle{mystyle}{
\fancyhf{} % delete current setting for header and footer
\fancyhead[L]{\bfseries\rightmark}
\fancyhead[R]{\bfseries\thepage}
\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}
\addtolength{\headheight}{1pt} % make space for the rule
\fancyfoot[L]{\bfseries \it{\bfseries{}}} %footer here
}
% %LOOKS LIKE THE FANCY HEADER USES PLAIN FANCYPAGESTYLE FOR THE FIRST PAGE OF EACH CHAPTER.
\fancypagestyle{plain}{
\fancyhead{}% get rid of headers on plain pages
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{1pt}
\fancyfoot[C]{\bfseries \thepage}
}
\fancypagestyle{empty}
{
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
%End Global Settings
%\setlength{\topmargin}{-0.3in}
%\setlength{\topskip}{0.3in} % between header and text
\setlength{\textheight}{8.4in} % height of main text
%\setlength{\textwidth}{5.8in} % width of text
%\setlength{\oddsidemargin}{0.75in} % odd page left margin
%\setlength{\evensidemargin}{0.75in} % even page left margin
%\addtolength{\evensidemargin}{-2cm}
%\addtolength{\oddsidemargin}{-2cm}
%\addtolength{\textwidth}{2cm}
\begin{document}
\nocite{*}
\pagestyle{empty}
\input{Title.tex}
% !TeX program = xelatex
\input{dedication2.tex}
\input{Tribute.tex}
\input{dedicate.tex}
\input{SSSUCertificate.tex}
\input{Declaration.tex}
\frontmatter
\pagestyle{plain}
\tableofcontents
\pagenumbering{roman}
\listoffigures
\input{Ack.tex}
\addcontentsline{toc}{chapter}{Acknowledgements}
\input{Abstract.tex}
\addcontentsline{toc}{chapter}{Abstract}
%\listoftables
%\addcontentsline{toc}{chapter}{List of Figures}
%\addcontentsline{toc}{chapter}{List of Figures}
\mainmatter
\pagestyle{mystyle}
%\chapterfont{\color{Aquamarine}}
%\sectionfont{\color{MidnightBlue}}
%\subsectionfont{\color{RedViolet}}
%input your tex files using the input command
\input{intro.tex}
\addcontentsline{toc}{chapter}{Introduction}
\input{chapter1.tex}
\input{chapter2.tex}
\input{chapter3.tex}
\input{chapter4.tex}
\bibliographystyle{plain}
%create a bibiliograpgy file using jabref and input the file name below. In this case it is refs.bib
\bibliography{refs}
\addcontentsline{toc}{chapter}{Bibliography}
\end{document}
谢谢您的帮助和建议。
答案1
启动主要内容后,使用以下命令应该可以解决第一个问题:
\setcounter{page}{1}
这将重置页码。
对于第二个问题,我将使用该titlesec
包来设置章节页面的页面样式:
\assignpagestyle{\chapter}{plain}
这是必要的,因为\chapter
默认设置了普通的页面样式。