2

I'd like to show the bibliography in the TOC.

This is how far I got:

\clearpage
\def \nextsection{\thesection + 1}
\addcontentsline{toc}{section}{\nextsection Bibliography}
\printbibliography
\thispagestyle{empty}
  • \clearpage For some reason, the page number wasn't right without this. It would seem, the bibliography command alone won't increment it.

  • \def ... This is meant to return an integer. Actually, it returns a string (for example, 11 + 1), so the computation is not performed; the arithmetic is taken literally. I could replace this by the section I know it to be, but that would break if I ever were to add another section (assuming the bibliography would remain last). Yet another problem (while a detail) is the incorrect spacing of the TOC: see the screenshot below.

  • \thispagestyle{empty} As I'd like the page number not to show up on the bibliography page (works).

Also, I'd say "Bibliography" is a bit pretentious. Is there a way to change it to, say, "References" or "Sources"? This is actually related to this question: perhaps that way, I could name it to use the "increase section" function so that it will show up as (say) "12. Sources" both in the TOC and as page header?

Edit

As for the name, and header, this is an improvement:

\clearpage
\renewcommand\bibname{12 Sources}
\addcontentsline{toc}{section}{\bibname}

Still: explicit section number (no increment), TOC align thing, and, for a clickable TOC, you don't get to the correct place by clicking the Sources line (probably because of the \clearpage).

Edit 2: MWE

OK, check out the MWE here.

Files: Makefile; x.bib, x.tex; and x.pdf

Problems, already described above and in comments: Increment, TOC align, clickable, consistent header looks.

incorrect spacing http://user.it.uu.se/~embe8573/bib.png

  • To change the section header of the bibliography when using the report document class, issue a command such as \renewcommand\bibname{Sources} (or whatever alternative title you prefer). – Mico Mar 4 '13 at 3:07
  • @Mico: Yes, that's much better: see the edit! – Emanuel Berg Mar 4 '13 at 3:30
  • Please create a complete MWE (minimum working example) of what you're trying to achieve. I'm afraid that the code snippets you've provided so far create a rather incomplete picture of your objectives. For instance, it's only in the follow-up edit that you mention (implicitly) that you're also using the hyperref package. – Mico Mar 4 '13 at 3:33
  • @Mico: Objectives are clear: Increment function, and TOC align thing (see screenshot). Yes, I'll post an MWE as soon as it is done. – Emanuel Berg Mar 4 '13 at 3:43
  • @Mico: Check out MWE in edit. – Emanuel Berg Mar 4 '13 at 4:30
2

You can define the header behavior of the bibliography using biblatex commands.

What you have to do is to define the header like this

\defbibheading{headername}[\bibname]{%
  % new definition
}

and if you use the same name as the default: bibliography you don't have to do anything to the \printbibliography macro. If you chose to change the name (like in this example) you should pass it to the macro like this: \printbibliography[heading=headername]. And that should do the trick.

With this you don't need to add the bibliography to the ToC because it's done automatically when you define it in the header as a section.

\documentclass[a4paper, twoside, 12pt]{report}

\usepackage{filecontents}

\begin{filecontents}{x.bib}
@Book{luger,
author = {George Luger},
title = {Artificial Intelligence},
subtitle = {Structures and Strategies for Complex Problem Solving},
year = {2009}}
\end{filecontents}

\usepackage[colorlinks]{hyperref}

\usepackage[style=authortitle-icomp,backend=biber]{biblatex}
\addbibresource{x.bib}

\usepackage{scrextend}
\deffootnote[1.8em]{0pt}{1.6em}{\makebox[1.8em][l]{\thefootnotemark.}}
\renewcommand{\footnoterule}{%
  \kern -3pt
  \hrule width \textwidth height 1pt
  \kern 2pt
}

% Note that you can name it bibliography and overwrite the default
\defbibheading{mybibliography}[\bibname]{%
\section{#1}}


\usepackage{titlesec}
\newcommand{\sectionbreak}{\clearpage}
\renewcommand\thesection{\arabic{section}}

\begin{document}

\tableofcontents
\thispagestyle{empty}

\section{First section}
Test of note.\footcite[127]{luger}

\section{Second section}
Test of paragraph for TOC.

\clearpage
\renewcommand\bibname{Sources}
\printbibliography[heading=mybibliography]
\thispagestyle{empty}

\end{document}
  • This works great! Only, I had to put \newbibmacro{in:}{} to get it to show up in the ToC. Those other problems: align, counting, hyperref, header size, new header name - well, you aced the quiz, if there ever was one! – Emanuel Berg Mar 5 '13 at 0:29

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.