一本书中有多个页眉和页码

一本书中有多个页眉和页码

由于某种原因,我在每个奇数页上都看到“目录”。另一个问题是分页在主要内容的第二版之后被重置。非常感谢您的帮助。以下是 的代码Brillpreamble

% XeLaTeX can use any Mac OS X font. See the setromanfont command below.
% Input to XeLaTeX is full Unicode, so Unicode characters can be typed directly into the source.

% The next lines tell TeXShop to typeset with xelatex, and to open and save the source with Unicode encoding.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\usepackage{booktabs}
\usepackage{ledmac}
\linenummargin{inner}
\sidenotemargin{outer}
\usepackage{fancyhdr}
\fancyhf{} % sets both header and footer to nothing
\renewcommand{\headrulewidth}{0pt}
% your new footer definitions here
\fancyhead[CE,CO]{Text 1} 
\fancyhead[CE,CO]{Text 2}
\usepackage{adforn}
\usepackage{amsmath}
\usepackage{hanging}
\usepackage{pdfpages}
\textheight = 180.5 mm
\textwidth = 108.5 mm
\pagenumbering{arabic}
\usepackage[hang]{footmisc}
\setlength{\footnotemargin}{12pt}
\makeatletter
\renewcommand\@makefntext[1]{%
  \noindent\makebox[1em][r]{\@makefnmark}#1}
\makeatother
\usepackage{imakeidx} 
\makeindex[name=nominum, title=Index nominum, columns=2]
\makeindex[name=rerum, title=Index rerum, columns=2]
\pretolerance=100
\usepackage{microtype}

%\usepackage{geometry}                % See geometry.pdf to learn the layout options. There are lots.
%\geometry{a4paper}                   % ... or a4paper or a5paper or ... 
%\geometry{landscape}                % Activate for for rotated page geometry
%\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}

\usepackage{amssymb}
%\renewcommand %These two commands are for double-spacing
%\baselinestretch{2}

% Will Robertson's fontspec.sty can be used to simplify font choices.
% To experiment, open /Applications/Font Book to examine the fonts provided on Mac OS X,
% and change "Hoefler Text" to any of these choices.

\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Brill}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Gill Sans}
\setmonofont[Scale=MatchLowercase]{Andale Mono}
\frenchspacing

\newfontfamily{\H}[Scale=0.9]{Lucida Grande}
\usepackage{caption}
\captionsetup{aboveskip=5pt}

\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist

\setcounter{secnumdepth}{0} % sections are level 1

这是我的主要文件:

\documentclass[11pt,twoside]{book}
\input{Brillpreamble}
\begin{document}
\frontmatter
\include{titleBrill}
\renewcommand\contentsname{Table of Contents}
\tableofcontents
\include{abbrevBrill}
\include{prefaceandintroBrill}
\mainmatter
\include{RainoldetextBrill}
\include{MedlyetextBrill}
\backmatter
\printindex[nominum]
\printindex[rerum]
\include{BiblioBrill}
\end{document}

答案1

整个问题在于pagestyle使用了错误。在 或甚至 `\pagestyle{plain}\clearpage\pagestyle{fancy}之前显式地使用\tableofcontents有助于解决此问题。

我已经删除了此解决方案的所有不必要的代码

\documentclass[11pt,twoside]{book}

\usepackage{fancyhdr}
\fancyhf{} % sets both header and footer to nothing
\renewcommand{\headrulewidth}{0pt}
% your new footer definitions here
\fancyhead[CE,CO]{Text 1} 
\fancyhead[CE,CO]{Text 2}
\setlength{\headheight}{15pt}
\pagenumbering{arabic}


\usepackage{blindtext}

\setcounter{secnumdepth}{0} % sections are level 1

\renewcommand\contentsname{Table of Contents}

\pagestyle{fancy}
\begin{document}
\frontmatter
\blindtext[20]
\clearpage
\pagestyle{plain}
\tableofcontents
\cleardoublepage
\pagestyle{fancy}
\mainmatter

\chapter{Foo}
\blindtext[20]
\backmatter
\chapter{Bar}
\blindtext[20]
\end{document}

相关内容