3

I want the list of figures (LOF), list of tables (LOT) and bibliography (BIB) all to appear numbered in my table of contents (TOC) using report documentclass. I know one can use the tocbibind package to achieve this, but I am also using the quotchap package to get more fancy chapter headings.

To get the right appearance, I need LOF,LOT and BIB all to act like a \chapter command, while per default they are using \chapter* (so without numbering). This produces a large chapter number and the chapter title beneath, as you can see it in the standard chapter in the minimal working example (MWE) below.

Using the etoolbox package, I can modify the LOF and LOT commands such that they indeed use a numbered chapter, using the \patchcmd command

\patchcmd{\listoffigures}{\chapter*}{\chapter}{}{}  %force list of figures to have numbered chapter appearance
\patchcmd{\listoftables}{\chapter*}{\chapter}{}{}   %force list of tables to have numbered chapter appearance

But this does not work with the BIB command.

\patchcmd{\bibliography}{\chapter*}{\chapter}{}{}  %does NOT work

Using the tocbibind package I can achieve the right behaviour for the BIB, by doing

\usepackage[numbib,chapter]{tocbibind}   %manipulate bib appearance

while the numbib parameter forces the BIB to be numbered and act like a normal chapter. Hence it then has the correct chapter style and appears in the TOC as desired. BUT this cancels out the achievement on LOF and LOT, which are not not labeled anymore, but still appear (unlabeled) in the TOC.

Does anyone know how to achieve this for LOF, LOT and BIB at the same time?

Here is a minimal working example (MWE)

\documentclass[a4paper,twoside,11pt,titlepage]{report}

\usepackage[grey]{quotchap}              %custom chapter appearance
\usepackage{etoolbox}                    %change commands with patchcmd
\usepackage[numbib,chapter]{tocbibind}   %manipulate bib appearance

\patchcmd{\listoffigures}{\chapter*}{\chapter}{}{}  %force list of figures to have normal chapter appearance
\patchcmd{\listoftables}{\chapter*}{\chapter}{}{}   %force list of tables to have normal chapter appearance

\begin{document}

\tableofcontents

\chapter{A normal chapter}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

\appendix

\listoffigures
\listoftables

\bibliography{bibl}{}
\bibliographystyle{plain}

\end{document}
3
  • 2
    Hi and welcome, using patchcmd is very elegant and resolves the first issue. But for the bib, why not just use the very basic and low-level approach? Setting the counter by hand and adding the toc-entry? \refstepcounter{chapter} \addcontentsline{toc}{chapter}{\numberline\thechapter\bibname} Package tocbibind is not needed anymore.
    – Johannes_B
    Oct 2, 2014 at 12:57
  • Thanks for this nice hint! I although try to avoid messing with counters, which often leads to other problems. This is why I wanted a clean patch of the few commands and was only missing the solution for the bibliography.
    – HeXor
    Oct 2, 2014 at 15:29
  • Internally, the very same happens (but some other stuff as well).
    – Johannes_B
    Oct 2, 2014 at 17:01

1 Answer 1

4

\bibliography is only a macro that uses \begin{thebibliography}...\end{thebibliography} environment via an input statement, therefore there is no chapter* call inside \bibliography, but in \thebibliography environment startup code.

That's why it fails.

\patchcmd{\thebibliography}{\chapter*}{\chapter}{\typeout{success}}{\typeout{failed}}

works however.

\documentclass[a4paper,twoside,11pt,titlepage]{report}

\usepackage[grey]{quotchap}              %custom chapter appearance
\usepackage{etoolbox}                    %change commands with patchcmd
%\usepackage[numbib,chapter]{tocbibind}   %manipulate bib appearance

\patchcmd{\listoffigures}{\chapter*}{\chapter}{}{}  %force list of figures to have normal chapter appearance
\patchcmd{\listoftables}{\chapter*}{\chapter}{}{}   %force list of tables to have normal chapter appearance
\patchcmd{\thebibliography}{\chapter*}{\chapter}{\typeout{success}}{\typeout{failed}}   %force list of tables to have normal chapter appearance

\begin{document}

\tableofcontents

\chapter{A normal chapter}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

\appendix


\listoffigures
\listoftables

\bibliography{bibl}{}
\bibliographystyle{plain}


\end{document}

enter image description here

Edit Additional explanation.

The report class does not define \bibliography itself, it uses the common latex.ltx. It's defined there something like this

\def\bibliography#1{%
  \if@filesw
    \immediate\write\@auxout{\string\bibdata{#1}}%
  \fi
  \@input@{\jobname.bbl}}

The \begin{thebibliography}...\end{thebibliography} commands are written to the .bbl file by bibtex or biber, but \bibliography inputs this environment via @input.

2
  • This indeed is what I was searching for! In fact I was also searching for the inner "structure" of the \bibliography command. For curiosity, where can I find information like that, to see what is the actual code of these wrappers!?
    – HeXor
    Oct 2, 2014 at 15:27
  • 1
    @HeXor: Well, I have to correct my statement: \bibliography is no direct wrapper, but I always look first into the class file/package file if something is unclear.
    – user31729
    Oct 2, 2014 at 16:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .