我将其用作\usepackage{fancyhdr}
页眉,但我认为它会导致一些“章节”出现问题,而这些章节实际上并不是章节,例如目录和参考书目。在目录的第二页页眉上写着“第 0 章”(第一页是清晰的),并且它在“第 0 章”和“目录”之间的交替页面上继续。
参考书目中也几乎发生了同样的事情,但在这种情况下只写了“章节”这个词。它也在“章节”和“参考书目”之间交替出现
我怎样才能让它不只在文档的这两个部分显示“第 0 章”和“章节”?我不介意在它们的位置或“目录”和“参考书目”字样的位置写上任何内容,但我想保留页码原样以及页面顶部的行。
\documentclass[12pt, twoside]{report}
% package to activate greek language - the sequence languages appear below is IMPORTANT!!!
\usepackage[greek,english]{babel}
\usepackage{varioref}
%\usepackage{hyperref}
% package to handle graphics
\usepackage{graphicx}
% package to handle multiple figures in a minipage
\usepackage{subfigure}
% package to extend math capabilikai ties
\usepackage{amsmath,amssymb,isotope}
\usepackage[version=3]{mhchem}
%package to activate XeTeX font manager
\usepackage{fontspec}
% DOCUMENT LAYOUT
\usepackage{geometry}
\geometry{a4paper, textwidth=6in, textheight=8.5in, marginparsep=7pt, marginparwidth=.6in}
%\geometry{a4paper}
\setlength\parindent{8mm}
\setlength\parskip{5mm}
% FONTS
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{xcolor}
\defaultfontfeatures{Mapping=tex-text} % converts LaTeX specials (``quotes'' --- dashes etc.) to unicode
%\setromanfont [Ligatures={Common}, BoldFont={GFS Artemisia Bold}, ItalicFont={Gentium Italic}]{Gentium}
%\setmonofont[Scale=0.8]{Monaco}
\setmainfont{Times New Roman}
% ---- CUSTOM AMPERSAND
\newcommand{\amper}{{\fontspec[Scale=.95]{Times New Roman}\selectfont\itshape\&}}
% package to handle line spacing
\usepackage{setspace}
% HEADINGS
\usepackage{sectsty}
\usepackage[normalem]{ulem}
\sectionfont{\rmfamily\mdseries\upshape\Large}
\subsectionfont{\rmfamily\bfseries\upshape\normalsize}
\subsubsectionfont{\rmfamily\mdseries\upshape\normalsize}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\fancyhf{}
\fancyhead[LO]{\chaptername~\thechapter}
\fancyhead[RE]{\leftmark}
\fancyhead[RO,LE]{\thepage}
\usepackage{afterpage}
\newcommand\blankpage{
\null
\thispagestyle{empty}
\addtocounter{page}{-1}
\newpage
}
% PDF SETUP
% ---- FILL IN HERE THE DOC TITLE AND AUTHOR
\usepackage[driverfallback=dvipdfmx, bookmarks, colorlinks, breaklinks, pdftitle={name - title},pdfauthor={name}]{hyperref}
\hypersetup{linkcolor=blue,citecolor=blue,filecolor=black,urlcolor=blue}
% package for fancy style headers and footers
\usepackage{fancybox}
% redefine bullet symbols and section style
\renewcommand\thesection{\arabic{section}}
\renewcommand{\labelitemi}{$\blacktriangleright$}
\renewcommand{\labelitemii}{$\bullet$}
% change captions especially for greek language - if the document is in ENGLISH, they should vanish
\addto\captionsenglish{%
\renewcommand\prefacename{Πρόλογος}%
\renewcommand\refname{Αναφορές}%
\renewcommand\abstractname{Περίληψη}%
\renewcommand\bibname{Βιβλιογραφία}%
\renewcommand\chaptername{Κεφάλαιο}%
\renewcommand\appendixname{Παράρτημα}%
\renewcommand\contentsname{Περιεχόμενα}%
\renewcommand\listfigurename{Κατάλογος Σχημάτων}%
\renewcommand\listtablename{Κατάλογος Πινάκων}%
\renewcommand\indexname{Ευρετήριο}%
\renewcommand\figurename{Σχήμα}%
\renewcommand\tablename{Πίνακας}%
\renewcommand\partname{Μέρος}%
\renewcommand\enclname{Συνημμένα}%
\renewcommand\ccname{Κοινοποίηση}%
\renewcommand\headtoname{Προς}%
\renewcommand\pagename{Σελίδα}%
\renewcommand\seename{βλέπε}%
\renewcommand\alsoname{βλέπε επίσης}%
\renewcommand\proofname{Απόδειξη}%
\renewcommand\glossaryname{Γλωσσάρι}%
}
\usepackage{xgreek}
\renewcommand{\thesection}{\thechapter.\arabic{section}}
%%%%%%%%% END OF PREAMBLE %%%%%%%%%%%%
\begin{document}
\setlanguage{greek} %% this is to activate greek hyphenation
% make title out of \author, \title, \date specified in the preamble
\input{thesis_01_titlepage}
% create a blank page immediately after the cover page
\afterpage{\blankpage}
% This is only meant to include the NuSTRAP group logo in a separate page.
% Remove it if not interested.
\include{thesis_02_abstract}
\afterpage{\blankpage}
\include{thesis_03_dedication}
\afterpage{\blankpage}
% Create table of contents - not mandatory
{
\hypersetup{linkcolor=black}
\clearpage
\tableofcontents
}
\afterpage{\blankpage}
% Create a list of figures - not mandatory
%\listoffigures
% include files with content. Changes the names according to your taste.
\chapter{Πρόλογος}
\input{thesis_04_intro}
\chapter{Τίτλος}
\input{thesis_05_theory}
\chapter{Κι άλλος τίτλος}
\input{thesis_06_title}
\chapter{Ένας ακόμη τίτλος}
\input{thesis_07_anothertitle}
\bibliographystyle{abbrv} % bibliography style is abbrv: eg. [1]
\bibliography{thesis_references} % this is the .bib file that holds the bibliography records
\appendix
\renewcommand*{\thechapter}{\Roman{chapter}}
\chapter{Παράρτημα}
\input{thesis_appx01_tests}
\end{document}
编辑:\markboth{Name of appendix}{Appendix III}
我使用下面的方法解决了附录问题
\chapter{Name of appendix}
。只有 3 个附录,所以没什么大惊小怪的。
答案1
如果除了目录和参考书目之外没有其他未编号的章节,则可以使用:
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{\chaptername~\thechapter}}
\renewcommand{\sectionmark}[1]{}
\fancyhf{}
\fancyhead[LO]{\rightmark}
\fancyhead[RE]{\leftmark}
\fancyhead[RO,LE]{\thepage}
示例(不含不相关的内容):
\documentclass[12pt, twoside]{report}
\usepackage{blindtext}% only for dummy text
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{\chaptername~\thechapter}}
\renewcommand{\sectionmark}[1]{}
\fancyhf{}
\fancyhead[LO]{\rightmark}
\fancyhead[RE]{\leftmark}
\fancyhead[RO,LE]{\thepage}
\bibliographystyle{abbrv}
\begin{document}
\tableofcontents
\Blinddocument% dummy chapter
% dummy multipage bibliography
\bibliography{ascexmpl.bib}
\nocite{*}
% dummy chapters to get a multipage TOC
\Blinddocument\Blinddocument
\Blinddocument\Blinddocument
\Blinddocument\Blinddocument
\Blinddocument\Blinddocument
\end{document}
结果: