1

I would like to add a custom style to my bibliography. With this code:

\phantomsection
\addcontentsline{toc}{chapter}{\bibname}
\bibliographystyle{unsrt}
\bibliography{mybib.bib}{}
\thispagestyle{fancy}

I've the first page in plain style (no custom header and number on bottom), whereas other bibliography's pages use the fancy style. How can I set fancy also for the first page?

Note: I'm using book as document type.

  • Could you add a full MWE with all the relevant packages? I just had a test run and it seems that new chapters do not get the fancyheader on their first page; the bibliography, however, did get a header on its first page. – moewe Sep 4 '13 at 18:09
1

Please have a look to this complete MWE (package filecontentsis used to include a example Bib file in the MWE, \jobname is a placeholder for the name of your tex file (\jobname.tex)):

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Book{companion,
  author    = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
  title     = {The LaTeX Companion},
  edition   = {1},
  publisher = {Addison-Wesley},
  location  = {Reading, Mass.},
  year      = {1994},
}
@Book{adams,
  title     = {The Restaurant at the End of the Universe},
  author    = {Douglas Adams},
  series    = {The Hitchhiker's Guide to the Galaxy},
  publisher = {Pan Macmillan},
  year      = {1980},
}
\end{filecontents*}
\documentclass{book}
\usepackage[latin9]{inputenc}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{hyperref}

\pagestyle{fancy}
\renewcommand{\subsectionmark}[1]{\markright{ #1}}
\renewcommand{\sectionmark}[1]{\markright{ #1}}
\renewcommand{\chaptermark}[1]{\markright{ #1}}

\rfoot{}
\cfoot{}
\fancyhead[LO,RE]{\thesubsection \rightmark}
\fancyhead[RO,LE]{\thepage}
\renewcommand {\headrulewidth}{0pt}
\renewcommand {\footrulewidth}{0pt}

\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

\begin{document}

\chapter{Some chapter}

\section{Section I}
\lipsum[1-8]

\subsection{Subsection for this section}
\lipsum[1-2]

\pagestyle{plain}
\subsection{Another subsection}
\lipsum[1-2]
\nocite{*}

\cleardoublepage % This is new !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\fancypagestyle{plain}{% new plain style
  \fancyhf{}% Clear header/footer
  \fancyhead[R]{Test}% Right header
  \fancyfoot[L]{Name Firstname - v1.0 \\  Date}% Left footer
  \fancyfoot[R]{\thepage}% Right footer
}
\pagestyle{plain}
\phantomsection
\addcontentsline{toc}{chapter}{\bibname}
\bibliographystyle{unsrt}
\bibliography{\jobname}
\end{document}

See to line 56. I redefine style plain (see the difference to your style). So you get the first page of chapter `Bibliography with header and footer too. But let me remark it is not a good typography ...

Please see that you don't need bibwhen calling your bibliography (line 66).

  • If it is possible, I would like to avoid edit plain style, 'cause I'm using it in other pages such toc, list of tables, etc. – vdenotaris Sep 4 '13 at 21:33
  • 1
    @vdenotaris because the Bibliography is usual after TOC, list of tables etc. this would be not a problem. But you can redefine it a second time with the parameters you need after your bibliography ... – Mensch Sep 4 '13 at 21:37

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.