0

I want to change the headings in my document with fancyhdr in my document to be bold and lower case:

enter image description here

This is quite easily done by using fancyhdr:

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} 
\fancyhead[OC]{\nouppercase{\rightmark}}
\headheight=28pt
\fancyfoot[C]{\thepage}
\renewcommand{\chaptermark}[1]{\markboth{\bfseries\thechapter\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\bfseries\thesection\ #1}}
\renewcommand{\headrulewidth}{0.4pt}

My problem is, that I also would like to change the headings the same way for the table of contents, bibliography and so on. I managed already to prevent LaTeX from printing the headings here all uppercase by using

\fancyhead[OC]{\nouppercase{\rightmark}}

but I have issues to get the heading in bold letters:

enter image description here

enter image description here

I guess my problem here is, that the table of contents and the bibliography are put following a \frontmatter and \backmatter respectively, which probably interferes with my intention and the use of \chaptermark within the fancyhdr commands.

If I alter the command preventing the upper case letters to

\fancyhead[OC]{\bfseries{\nouppercase{\rightmark}}}

then I am able to produce bold headings in the TOC and bibliography, but I am unsure if this is an appropriate way to do so. So what is the better way to address the TOC, bibliography and so on in fancyhdr to get a clean snippet of code?

MWE

\documentclass[12pt,oneside,a4paper]{book}
%
\usepackage{lipsum}
\usepackage[backend=bibtex8,sorting=none,style=numeric-comp]{biblatex}
%
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[OC]{\nouppercase{\rightmark}}
%\fancyhead[OC]{\bfseries{\nouppercase{\rightmark}}}
\headheight=28pt
\fancyfoot[C]{\thepage}
\renewcommand{\chaptermark}[1]{\markboth{\bfseries\thechapter\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\bfseries\thesection\ #1}}
\renewcommand{\headrulewidth}{0.4pt}
\fancypagestyle{plain}{\fancyhf{}\fancyfoot[C]{\thepage}\renewcommand{\headrulewidth}{0pt}} % Redefine plain style, it is used for pages with new chapters
%
\usepackage{filecontents}
%
\begin{filecontents*}{database.bib}
@book{texbook,
  author  = {Donald E. Knuth},
  title   = {The {{\TeX}book}},
  publisher   = {Addison-Wesley},
  date    = {1984}
  }

@TECHREPORT{001,
  author = {Hans Mustermann},  
  title = {Just some random title},  
  number = {ABCD-E/2008/de/1234},  
  institution = {ACME Inc.},  
  year = {2008}  
  }  

@TECHREPORT{002,
  author = {Jon Smith},  
  title = {Another random title},  
  number = {ABCD-E/2007/en/1234},  
  institution = {University of Nowhere},  
  year = {2007}  
  }

@article{article,
  author  = {Peter Adams}, 
  title   = {The title of the work},
  journal = {The name of the journal},
  year    = 1993,
  number  = 2,
  pages   = {201-213},
  month   = 7,
  note    = {An optional note}, 
  volume  = 4
}

@book{book,
  author    = {Peter Babington}, 
  title     = {The title of the work},
  publisher = {The name of the publisher},
  year      = 1993,
  volume    = 4,
  series    = 10,
  address   = {The address},
  edition   = 3,
  month     = 7,
  note      = {An optional note},
  isbn      = {3257227892}
}

@booklet{booklet,
  title        = {The title of the work},
  author       = {Peter Caxton}, 
  howpublished = {How it was published},
  address      = {The address of the publisher},
  month        = 7,
  year         = 1993,
  note         = {An optional note}
}

@conference{conference,
  author       = {Peter Draper}, 
  title        = {The title of the work},
  booktitle    = {The title of the book},
  year         = 1993,
  editor       = {The editor},
  volume       = 4,
  series       = 5,
  pages        = 213,
  address      = {The address of the publisher},
  month        = 7,
  organization = {The organization},
  publisher    = {The publisher},
  note         = {An optional note}  
}

@inbook{inbook,
  author       = {Peter Eston}, 
  title        = {The title of the work},
  chapter      = 8,
  pages        = {201-213},
  publisher    = {The name of the publisher},
  year         = 1993,
  volume       = 4,
  series       = 5,
  address      = {The address of the publisher},
  edition      = 3,
  month        = 7,
  note         = {An optional note}
}

@incollection{incollection,
  author       = {Peter Farindon}, 
  title        = {The title of the work},
  booktitle    = {The title of the book},
  publisher    = {The name of the publisher},
  year         = 1993,
  editor       = {The editor},
  volume       = 4,
  series       = 5,
  chapter      = 8,
  pages        = {201-213},
  address      = {The address of the publisher},
  edition      = 3,
  month        = 7,
  note         = {An optional note}
}
@manual{manual,
  title        = {The title of the work},
  author       = {Peter Gainsford}, 
  organization = {The organization},
  address      = {The address of the publisher},
  edition      = 3,
  month        = 7,
  year         = 1993,
  note         = {An optional note}
}

@mastersthesis{mastersthesis,
  author       = {Peter Harwood}, 
  title        = {The title of the work},
  school       = {The school where the thesis was written},
  year         = 1993,
  address      = {The address of the publisher},
  month        = 7,
  note         = {An optional note}
}

@misc{misc,
  author       = {Peter Isley}, 
  title        = {The title of the work},
  howpublished = {How it was published},
  month        = 7,
  year         = 1993,
  note         = {An optional note}
}

@phdthesis{phdthesis,
  author       = {Peter Joslin}, 
  title        = {The title of the work},
  school       = {The school where the thesis was written},
  year         = 1993,
  address      = {The address of the publisher},
  month        = 7,
  note         = {An optional note}
}

@proceedings{proceedings,
  title        = {The title of the work},
  year         = 1993,
  editor       = {Peter Kidwelly},
  volume       = 4,
  series       = 5,
  address      = {The address of the publisher},
  month        = 7,
  organization = {The organization},
  publisher    = {The name of the publisher},
  note         = {An optional note}
}

@techreport{techreport,
  author       = {Peter Lambert}, 
  title        = {The title of the work},
  institution  = {The institution that published},
  year         = 1993,
  number       = 2,
  address      = {The address of the publisher},
  month        = 7,
  note         = {An optional note}
}

@unpublished{unpublished,
  author       = {Peter Marcheford}, 
  title        = {The title of the work},
  note         = {An optional note},
  month        = 7,
  year         = 1993
}
\end{filecontents*}
%
\bibliography{database.bib}
%
\linespread{1.3}
%
\begin{document}%
\frontmatter
\tableofcontents
%
\mainmatter
\chapter{First}
    \section{First}
        \subsection{First}
            \lipsum
        \subsection{Second}
        \subsection{Third}
    \section{Second}
        \subsection{First}
        \subsection{Second}
        \subsection{Third}
    \section{Third}
        \subsection{First}
        \subsection{Second}
        \subsection{Third}
    \section{Fourth}
        \subsection{First}
        \subsection{Second}
        \subsection{Third}
    \section{Fifth}
        \subsection{First}
        \subsection{Second}
        \subsection{Third}
    \section{Sixth}
        \subsection{First}
        \subsection{Second}
        \subsection{Third}
%
\nocite{*}
%
\backmatter
\printbibliography[heading=bibintoc, title=References]
%
\end{document}
  • @Johannes_B: Are you willing to provide an answer? ;-) – user31729 Feb 4 '16 at 7:19
  • @ChristianHupfer Done, CW answer – Johannes_B Jul 17 '16 at 13:54
  • @Johannes_B: (+1) – user31729 Jul 17 '16 at 20:31
2

Yes, you already found the right way.

\documentclass[12pt,oneside,a4paper]{book}
%
\usepackage{blindtext}
\usepackage[backend=biber%it doesn't mather for the question at hand
,sorting=none,style=numeric-comp]{biblatex}
%
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[OC]{\nouppercase{\bfseries\rightmark}}
\headheight=28pt
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\fancypagestyle{plain}{\fancyhf{}\fancyfoot[C]{\thepage}\renewcommand{\headrulewidth}{0pt}} % Redefine plain style, it is used for pages with new chapters
%
%
    %
\bibliography{biblatex-examples.bib}
    %
\linespread{1.3}
    %
\begin{document}%
\frontmatter
\tableofcontents
    %
\mainmatter
\blinddocument
\blinddocument
\blinddocument
%
\nocite{*}
%
\backmatter
\printbibliography[heading=bibintoc, title=References]
%
\end{document}

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.