0

I use \usepackage{fancyhdr} for headers and I believe it is causing some problems with "chapters" that aren't really chapters, like the table of contents and bibliography. On the header of the second page of ToC there is written "Chapter 0" (the first page is clear), and it continues on alternating pages between "Chapter 0" and "Contents".

Almost the same thing happens in bibliography, but in this case only the word "Chapter" is written. It also alternates between the words "Chapter" and "Bibliography"

How can I make it not display "Chapter 0" and "Chapter" on only these two sections of the document? I don't mind if there is nothing written in their place or where the words "Contents" and "Bibliography" are, but I would like to keep the page number as it is and the line in the top of the page.

\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}

EDIT: I solved the problem with the appendices using \markboth{Name of appendix}{Appendix III} right under \chapter{Name of appendix}. There were only 3 appendices, so it wasn't a fuss.

  • Welcome to TeX.SE. – Mico Aug 15 at 4:35
0

If there are no other unnumbered chapters than the TOC and the bibliography, you could use:

\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}

Example (without the not related stuff):

\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}

Result:

enter image description here

enter image description here

enter image description here

| improve this answer | |
  • Also, in the ToC the word "Contents" and the number page have switched places for some reason. For the rest of the document, the page number is on the right for odd pages with the chapter name on the left and on the left for even pages with the chapter name on the right, but only on the ToC this is reversed. – Aggelos T. Aug 15 at 14:48
  • Link to two pics showing this: imgur.com/a/fJfuq65 (Κεφάλαιο 2 is Chapter 2 and Περιεχόμενα is Contents) – Aggelos T. Aug 15 at 14:55
  • @AggelosT. On the second picture an odd page is on the left hand side and the even page is on the right hand side. So the word "Contents" and the page number have not switched their places. It is either an issue of the viewer settings or you messed up the page number system (eg. a \pagenumbering command without a \cleardoublepage command before it). – esdd Aug 15 at 18:55
  • Yes, indeed you are right. I found the issue, too. I had a few extra '\afterpage{\blankpage}'. I removed them and now everything is alright. Thank you very much for your help! – Aggelos T. Aug 15 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.