fancyhdr 和目录、参考书目等中的标题

fancyhdr 和目录、参考书目等中的标题

我想将文档中的标题更改fancyhdr为粗体和小写:

在此处输入图片描述

这很容易做到,使用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}

我的问题是,我也想以同样的方式更改目录、参考书目等的标题。我已经设法LaTeX通过使用以下方法阻止在此处打印全部大写的标题

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

但我无法将标题变为粗体字:

在此处输入图片描述

在此处输入图片描述

我猜我的问题是,目录和参考书目分别放在\frontmatter和之后,这可能会干扰我的意图和命令中\backmatter的使用。\chaptermarkfancyhdr

如果我修改命令以阻止大写字母

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

然后我就可以在TOC和参考书目中生成粗体标题,但我不确定这是否是合适的方法。那么,处理TOC、参考书目等以fancyhdr获得干净的代码片段的更好方法是什么?

平均能量损失

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

答案1

是的,您已经找到了正确的方法。

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

相关内容