natbib and references in TOC

natbib and references in TOC

I want to both use natbib and have the bibliography appear in the table of
contents... I know that tocbibind will put the bibliography into the TOC if
you put:
\usepackage[nottoc,notlof,notlot]{tocbibind}
into the preamble. Of course, it does this by changing the bibliography
environment. Unfortunately, natbib does its own changes to the bibliography
environment too, and if I load them in the "wrong" order then the
bibliography changes won't happen.

Of course, you say, why not just load natbib and then tocbibind? Well, I
would if I could, but here's the situation:

- I'm working on a University of Edinburgh thesis class
- One of the university thesis regulations is that the bibliography must
- However, if I put any sort of thebibliography-changing commands into the
class itself, then my \usepackage{natbib} will stomp on those changes and
renew the environment itself.

*sigh*. So as I see it, I've got two options:
tocbibind or otherwise altering thebibliography... but then if the user
wants to load natbib again with different options, aren't they then
screwed?
- Put an \addcontentsline... into a skeleton sample file that will be
available with the class and hope that people don't take it out.

Anyone got any other suggestions?

Thanks,

MEF

--
Mary Ellen Foster, School of Cognitive Science, University of Edinburgh

--------------------- Law of Software Envelopment ---------------------
Every program attempts to expand until it can read mail.

natbib and references in TOC

> I want to both use natbib and have the bibliography appear in the table of
> contents... I know that tocbibind will put the bibliography into the TOC if
> you put:
>     \usepackage[nottoc,notlof,notlot]{tocbibind}
> into the preamble. Of course, it does this by changing the bibliography
> environment. Unfortunately, natbib does its own changes to the bibliography
> environment too, and if I load them in the "wrong" order then the
> bibliography changes won't happen.

> Of course, you say, why not just load natbib and then tocbibind? Well, I
> would if I could, but here's the situation:

> - I'm working on a University of Edinburgh thesis class
> - One of the university thesis regulations is that the bibliography must
> - However, if I put any sort of thebibliography-changing commands into the
>   class itself, then my \usepackage{natbib} will stomp on those changes and
>   renew the environment itself.

> *sigh*. So as I see it, I've got two options:
>   tocbibind or otherwise altering thebibliography... but then if the user
>   wants to load natbib again with different options, aren't they then
>   screwed?
> - Put an \addcontentsline... into a skeleton sample file that will be
>   available with the class and hope that people don't take it out.

> Anyone got any other suggestions?

It appears that you are the author of the class, which does give you
some advantages. I think that this will work, without having to use
anything from tocbibind, and also hopefully apply to any bibliography
environment. I'll assume that the class supports chapters and the
\AtBeginDocument{%

Quote:}

where Bibname is the heading text for the bibliography. (You might have
to throw in a \protect or two, but try it first). The incantation could
be initially put into the preamble of a test document to get it working
before adding it to the .cls file (don't forget \makeatletter, etc).

The idea is that at the \begin{document}, after all packages have
appended to the then current definition of \bibliography. It should also
ensure that the ToC addition occurs on the same page as the start of the
bibliography.

This is a trick I have only learned recently, but it is limited in
that you can only add stuff to a pre-existing macro, not change any

internal kernel command, and could be changed at any time. I am
contemplating producing a package for doing this kind of thing.

Peter W.

natbib and references in TOC

Quote:> I want to both use natbib and have the bibliography appear in the table of
> contents...

I realised that I got a bit too specific in asking this question. What I
should have asked was: is there a way to add some text to a macro without
just copying the standard definition from report.cls or whatever and adding

Thanks to Peter Wilson, I got put on the right track. His suggestion of

nice with macros that take arguments. But when I searched dejanews, I came
across a technique that does work. In my class file, I put:

\AtBeginDocument{%
\expandafter\def\expandafter\thebibliography\expandafter%
#\expandafter1\expandafter{\thebibliography{#1}%
\markboth{\bibname}{\bibname}}}

I didn't want to play with \bibliography because then this would only kick
in if the person using the class used bibtex; this way, if they explicitly
use a \begin{thebibliography}...\end{thebibliography} the commands will
still get added. So now the bibliography appears in the TOC and puts the
right marks in for the headers, however any other packages decide to futz
with the bibliography environment.

Here's a reference to the dejanews article that I got the above out of:
http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=635095381

Thanks for the quick and helpful responses!

MEF

--
Mary Ellen Foster, School of Cognitive Science, University of Edinburgh

--------------------- Law of Software Envelopment ---------------------
Every program attempts to expand until it can read mail.

Hello,

I'd like to stop natbib from creating a numbered references (bibliography)
list.
I created a citation style with custom-bib 4.00 to use with natbib 7.0.
The natbib documentation does not state how to redefine thebibliography
environment to suppress the numbering of references as it is standard.

Can someone help me with that?

Thanks a lot,
Stefan

---
University of Karlsruhe, Germany
Institute of Information Engineering and Management