3

How can I remove the bibliography from table of contents?

I'm using this code :

\begin{document}
\tableofcontents*

%content content content %

\nocite{*}
\bibliographystyle{plain}
\bibliography{bibliography}

\printindex

\end{document}
  • 3
    welcome to tex.sx. this is usually dependent on the document class you are using, but you haven't said which one that is. – barbara beeton Aug 26 '16 at 17:38
  • \documentclass[a4paper]{memoir} memoir :) – mpgn Aug 26 '16 at 17:48
4

As the O.P. stated he uses memoir as document class, so this is a possible (and most likely the easiest) solution:

Use the \nobibintoc command to prevent the inclusion of the bibliography in the ToC -- by default (see the relevant code at the end of this answer) \bibintoc is effective and enables the inclusion.

And here is the solution:

\documentclass{memoir}

\nobibintoc
\begin{document}
\tableofcontents*

\chapter{And now for something completely different}

\cite{Lam94}
\bibliographystyle{plain}
\bibliography{biblio}

%\printindex

\end{document}

enter image description here

Only for interested readers

Here's the relevant portion of memoir.cls which shows that inclusion of bibliography in the ToC is the default.

...
\newcommand{\@memb@bchap}{%
  \chapter*{\bibname}%
  \bibmark
  \ifnobibintoc\else
    \phantomsection
    \addcontentsline{toc}{chapter}{\bibname}%
  \fi
  \prebibhook}
\newcommand{\@memb@bsec}{\section{\bibname}\prebibhook}
\newcommand{\bibsection}{\@memb@bchap}

\newenvironment{thebibliography}[1]{%
  \bibsection
  \begin{bibitemlist}{#1}}{\end{bibitemlist}\postbibhook}
\newif\ifnobibintoc
\newcommand*{\bibintoc}{\nobibintocfalse}
\newcommand*{\nobibintoc}{\nobibintoctrue}
\bibintoc
...
|improve this answer|||||
  • Adding the code of the command just confuses this answer, IMO. Showing how to do it for the standard classes too might be more helpful. – Alan Munn Aug 26 '16 at 19:20
  • @AlanMunn: In standard classes there is no automatic addition of bibliography -- what should I show there then? Whatever I do there will be complains :-( – user31729 Aug 26 '16 at 19:22
  • Oops, you're right, I forgot the standard classes do it oppositely. But I still think you make things more complicated by adding the code. And there's another simple way to do this without \nobibintoc: \addcontentsline{toc}{\setcounter{tocdepth}{-1}} just before the \bibliography command. (Not needed for memoir but the simple way to exclude things usually I think. – Alan Munn Aug 26 '16 at 19:26
  • @AlanMunn: Do you really think that \addtocontents{...}{...} (!!!!) is easier than \nobibintoc for a (perhaps) not so experienced user, apart from eventually reversing it afterwards (depending on user's request)? ;-) – user31729 Aug 26 '16 at 19:32
  • 1
    No of course, not. And I didn't say that. But the memoir code fragment doesn't enlighten us on how to do it more generally, that's all, and this code fragment would. – Alan Munn Aug 26 '16 at 19:34
0

Just refer to Werner's simple and direct answer: make the command \addtocontents temporarily do nothing, add the bibliography, and then recover the command \addtocontents if it is required after the bibliography.

|improve this answer|||||
  • This is a legit answer; short but informative. – Symbol 1 Mar 20 at 19:40

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.