mneumann / latex-byu-thesis

Automatically exported from code.google.com/p/latex-byu-thesis
0 stars 0 forks source link

References/Bibliography section not included on the Table of Contents nor as a PDF bookmark #4

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Steps that will reproduce the problem:
1. Using WinEdt 5.4, pdflatex, MiKTeX, and the byumsphd class build a 
document with at least a table of contents and a bibliography. (If you, 
like me, prefer that your bibliography section be called References, I 
have found this command works, \settocbibname{References}.) 

Expected Output:
Ideally, the References/Bibliography section would be included on the 
table of contents and a PDF bookmark to the section will be added.

What do you see instead?
No entry on the table of contents and no pdf bookmark.

Original issue reported on code.google.com by dandelo...@gmail.com on 10 Mar 2007 at 2:59

GoogleCodeExporter commented 8 years ago
My initial workaround for this problem has been to use the tocbibind package. 
However, I also like to used the natbib package to sort my bibliography and to 
compress my citations. Unfortunately, these two packages are incompatible 
because 
they both redefine the bibliography environment. Fortunately, there is a hacked 
package available which I have attached to this issue, called tocnatbibind. You 
only 
need this package if you are also using natbib. If you are not, use tocbibind 
instead since it is more heavily tested.

Here is the latex I have used to solve the problem:

% These packages allow the bibliography to be sorted alphabetically and allow
% references to more than one paper to be sorted and compressed (i.e. instead of
% 5,2,4,6] you get [2,4-6])
\usepackage[numbers,sort&compress]{natbib}
\usepackage{hypernat}

% Required to include the bibliography in the table of contents
%\usepackage[nottoc,notlof,notlot]{tocbibind} % Use this one if you are not 
using
                                              % the natbib package
\usepackage[nottoc,notlof,notlot]{tocnatbibind} % Use this one if you are using 
the
                                                % natbib package (NOTE: This one is
                                                % not included with standard tex
                                                % sources. It was at one time
                                                % available here:
                                                % http://www.mpch-mainz.mpg.de/
                                                % ~joeckel/pdflatex/tocnatbibind.sty)

When using natbib, I have used the plainnat bibliographystyle with good results.

Original comment by dandelo...@gmail.com on 10 Mar 2007 at 3:09

Attachments:

GoogleCodeExporter commented 8 years ago
This issue has been fixed for all bibliographies, without having to monkeypatch 
them.
 The class file had to redefine the bib environment to look right anyway, so it was
easy to add a "refintoc" option that adds the appropriate contents line to the 
TOC. 
It shows up as "References" and is automatically bookmarked if hyperref is used.

Because this is very non-standard (to put references in the TOC), the option is 
off
by default.

Original comment by shiblon on 10 Mar 2007 at 7:17

GoogleCodeExporter commented 8 years ago
Close, but not quite in my environment (WinEdt, pdflatex, MiKTeX on Windows 
XP). The 
References section is added to the table of contents and the links and bookmark 
are 
added, but they point to the wrong page. On mine, they point to the last page 
of the 
section preceeding the bibliography. In my document, because of the way the 
pages 
fall, there is then a blank left page before the bibliography begins.

I looked in the class file and I'm not sure there is an easy way to fix this. 
By 
switching the order of the commands in the class file in this manner:

\old@bibliography{#1}%
\if@refintoc%
  \addcontentsline{toc}{chapter}{References}%
\fi%

The links go to the correct place, but the section is still called Bibliography 
in 
the document (it is References in the TOC and in the bookmark) and the page 
number 
in the table of contents is the last page of the bibliography rather than the 
first.

If there is another fix, it is beyond my abilities...

Original comment by dandelo...@gmail.com on 10 Mar 2007 at 7:47

GoogleCodeExporter commented 8 years ago
Try this before your \begin{document} but after \usepackage{natbib} (you are 
using
natbib, right?):

\renewcommand{\bibname}{References\addcontentsline{toc}{part}{References}}

On my system, this names everything correctly, inserts the appropriate contents 
line,
and (unfortunately) jumps about two pages too soon when clicked on. Two pages 
isn't
too shabby, though :-)

Original comment by shiblon on 10 Mar 2007 at 8:26

GoogleCodeExporter commented 8 years ago
Ignore that last.  Try this instead:

\renewcommand{\bibname}{References}
\let\oldbibsection\bibsection
\renewcommand{\bibsection}{\oldbibsection\addcontentsline{toc}{part}{References}
}

Original comment by shiblon on 10 Mar 2007 at 8:30

GoogleCodeExporter commented 8 years ago
I have reverted the change and am marking the bug as "wontfix", since it can 
(indeed,
must) be dealt with in the document itself, not in the class file.  Bib stuff 
is way
too idiosyncratic to try to force everyone to use natbib (even if it is the 
best,
most versatile style), so anything dealing with bibliographies really has to be 
done
by the author of the document, not the author of the class file.

Original comment by shiblon on 10 Mar 2007 at 8:44

GoogleCodeExporter commented 8 years ago
Okay, the above fix doesn't really work, and everyone is going to have this 
problem,
so I'm going to address it by creating a new .sty file based on natbib, 
especially
for BYU requirements.

Note that the above hack should work fine when using natbib with all references 
at
the end, but won't work at all with chapterbib.

Original comment by shiblon on 13 Mar 2007 at 12:16

GoogleCodeExporter commented 8 years ago
Added Josh

Original comment by shiblon on 13 Mar 2007 at 12:23

GoogleCodeExporter commented 8 years ago
I added an entry to the wiki about this issue: TipsAndTricks.  It's kind of a 
messy
problem, but avoiding chapterbib goes a long way toward solving it.  I'm still
noodling possible solutions, so this bug is going to remain open.

Original comment by shiblon on 13 Mar 2007 at 12:54

GoogleCodeExporter commented 8 years ago
Just as a quick note. Since my dissertation was a collection of papers, I had a
section on my introduction the listed the papers in bibliographical form. I 
used a
\begin{thebibliography} environment to do this, so the references hack above 
thought
it was a bibliography section and put a bookmark to it. Chris fixed this by
suggesting I put the hack right before the \bibliograph, and that worked.

Then, I had problems with collisions of the \bibitems in my publications list 
and the
ones in my bibtex file. To fix this I just renamed the bibtems in my 
publications
list by adding a "2" to the end of each one. This prevented collisions.

Original comment by joshua.m...@gmail.com on 13 Mar 2007 at 6:28

GoogleCodeExporter commented 8 years ago
As an update to my original comment on this issue (comment #1), there do not 
actually appear to be any conflicts between tocbibind.sty and natbib.sty. 
Ignore the 
tocnatbibind.sty file I attacehd to that comment and just use tocbibind.sty as 
it is 
used in the original post.

Original comment by dandelo...@gmail.com on 13 Mar 2007 at 4:07

GoogleCodeExporter commented 8 years ago
As an update to my original comment on this issue (comment #1), there do not 
actually appear to be any conflicts between tocbibind.sty and natbib.sty. 
Ignore the 
tocnatbibind.sty file I attacehd to that comment and just use tocbibind.sty as 
it is 
used in the original post.

Original comment by dandelo...@gmail.com on 13 Mar 2007 at 4:09

GoogleCodeExporter commented 8 years ago
I would like to get this nailed down, either through documentation or 
otherwise.  If
you have some wisdom to add to the wiki, please do it.  You are also welcome to 
check
out the source via subversion and edit the example file in the distribution to 
handle
these issues in the proper way.

Please email me personally with any thoughts you may have so that I can make 
sure
this thing works for up and coming graduates.

Original comment by shiblon on 3 Apr 2007 at 2:29

GoogleCodeExporter commented 8 years ago
Closing the bug.  Revision 24 addresses it via documentation in the example 
file.

Original comment by shiblon on 6 Jul 2007 at 1:50