mneumann / latex-byu-thesis

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

Weirdness on Windows with TOC bib links #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Pertinent conversation follows.  Hacked file attached.

Chat with Dan Delorey and Chris Monson:

 i submitted my electronic thesis yesterday and found that they have some
additional requirements that are not in the byumsphd class
  i'm not sure if it's because they were new or because you did them manually
  they are...
 1) pdf bookmarks for the title page, abstract, table of contents, list of
figures and list of tables. I have edited my version of the class to add these.
 2) include the References section in the table of contents and add a
bookmark for it (adding it to the toc adds the bookmark, of course). If it
is possible to do this in the class, that's beyond my know-how. I did add
it to my main tex file. There are two different ways to do it depending on
whether natbib is being used.
  If you want, I can send you those updates. Let me know.
 me: That stuff belongs in the .tex file, not in the class.
  That's why the example file is not totally simple.
 The bookmarks all happen automatically if you're using ps2pdf :0p
  :-p
 I don't think that the class is broken, but I'd be glad to look at it.
  The requirements you're reading to me, however, do not sound at all new.
    45 minutes
 Dan: still there?
  those are probably some of the problems you had alluded to with using
pdflatex
 to get the references to show up in the table of contents, I had to use
tocbibind (i actually used tocnatbibind since I'm using natbib which
conflicts with tocbibind)
 To get the other required bookmarks, I added \pdfbookmark commands to the
appropriate functions in the class
 me: There wasn't a "References" section?
  How did you include your bibliography?
 Dan: what would have been better ways to do that
 me: I don't know. I've honestly never used pdflatex.
 Dan: \bibliographystyle{plainnat}
\bibliography{thesis}
 me: That should create a "References" section that shows up in your TOC.
 Dan: hmmmm
  it doesn't at least the way i'm compiling
 me: That's all they want to be linked. They don't want every single
reference in the TOC.
  Weird. It worked for me....
 Dan: right, i get that
  strange
 i know i'm not the only one in the world, because i was able to find
plentiful advice online pointing me to tocbibind.sty which is a standard
file included in the tex source
  at least the one that comes with miktek
 me: Hm.
 Dan: the whole purpose of tocbibind is to include the toc, lof, lot, and
bib on the toc
 me: Oh, interesting.
  I use tetex.
  And it just Works.
 Dan: ah, that must be it
 me: Are you on Windows?
 Dan: i am
 me: That must be it.
  Hmmm.
 Dan: :S
  :)
 me: No, seriously. There are big differences.
 Dan: i know
 me: I had no idea it would be a problem for Windows users. It works
flawlessly for Linux users.
 Dan: i was just showing the appropriate penance for using windows :)
 me: Hmmm. I have no clue how to fix this....
  Since I can't test it :-/
 Dan: well, i've made all the fixes
 if you want to test the fixes to see if the break linux, i can do the
windows testing
 me: Can you send them to me once you have it all figured out? I'll try to
figure out how to incorporate them or provide an option that does.
 Dan: yeah, it should be really easy actually
 me: Okay, cool.
 Dan: it was just four additions of \pdfbookmark commands in the class
 me: I want this to be easy for Windows users, too, not just Linux users.
That would kind of defeat the purpose to only work well on one platform.
 Oh, crap. No.
  No pdf commands in the class.
  I'll have to see if there is some way we can do that conditionally.
  The class purposefully has no knowledge of the underlying output format.
 Dan: hmmm
  k
 me: PDF, PS, it doesn't care.
 Dan: than it will be a bit more complex
  does a pdfbookmark command hurt a ps?
 me: Yeah, ick.
 pdfbookmark isn't known to the class unless I import a pdf style inside of
it, and I believe it may even be pdflatex-specific.
  That's a non-goal.
  I'll have to think about that....
  But still, get it working and send it along, and maybe I'll be able to
work out a solution that makes sense for all users :-)
 Dan: k. will do
 me: Thanks for working on it, and sorry it's been painful.
 Dan: no problem

Email from Dan Delorey:

I've attached my updated class. The changes I made are the lines
immediately following the \clearpage command in titlepage, abstractpage,
tableofcontents, listoffigures, and listoftables. Since it is already
working for you on Linux, I'm confident there must be a non-ouput specific
command that achieves the same result. I'm happy to test any updates on
Windows.

Also, to get the bibliography on the TOC and call it References rather than
Bibliography in my setup, I added the following commands. The natbib and
hypernat commands are not strictly required, but I like my references
sorted and I really like the citations compressed as in the example below.
If there is a better way to do that, please let me know.

% 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)

% Use this if you want your Bibliography section to be called References
\settocbibname{References}

Original issue reported on code.google.com by shiblon on 10 Mar 2007 at 4:14

Attachments:

GoogleCodeExporter commented 9 years ago
Attachment didn't go through.  Retrying.

Original comment by shiblon on 10 Mar 2007 at 4:16

Attachments:

GoogleCodeExporter commented 9 years ago
Adding Dan as a CC on this.

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

GoogleCodeExporter commented 9 years ago
Here is a patch, to make things a little more clear.  It is inline, rather than 
just
being attached.  (Note that the attachment was formated with DOS line endings, 
which
made diffs weird until I changed them to Unix line endings, so that file is not
necessarily useful by itself).

PATCH:

Index: byumsphd.cls
===================================================================
--- byumsphd.cls    (revision 2)
+++ byumsphd.cls    (working copy)
@@ -1,11 +1,11 @@
 % BYU MS/PhD LaTeX Class File
-%   (version $Id: byumsphd.cls 4619 2007-03-10 04:03:10Z chris $)
+%   (version $Id: byumsphd.cls,v 1.1 2006/07/18 23:07:42 dan Exp $)
 %
 % Copyright (c) 2006 Christopher K. Monson
 % The latest version of this file may be obtained from
 %   http:www.bouncingchairs.net/oss
 %
-% License: LaTeX Project Public License (www.latex-project.org/lppl.txt)
+% License: LaTeX Project Public License (http://www.latex-project.org/lppl.txt)
 %   Executive summary:
 %       This software is copyright but you are granted a license which gives
 %       you, the "user" of the software, legal permission to copy, distribute,
@@ -13,10 +13,6 @@
 %       then distribute it (even just locally) you must change the name of the
 %       software to avoid confusion.
 %
-% OR (dual-licensed)
-%
-% License: GNU Lesser General Public License (www.gnu.org/licenses/lgpl.html)
-%
 % Author Information:
 %   Christopher K. Monson
 %   Brigham Young University
@@ -26,14 +22,7 @@
 % send those to the author as well so that this class has a single point of
 % distribution and all may benefit.
 %
-% Version: 1.0.3
-%
 % Changelog:
-%   Chris Monson (2007-03-09):
-%       *   Added the LGPL as an alternate license
-%   Chris Monson (2007-02-01):
-%       *   Created a version number and bumped it to 1.0.3
-%       *   Added option for setting "Department of" string to something else
 %   Chris Monson (2006-03-13):
 %       *   Removed some cruft
 %       *   Established some suitable defaults
@@ -41,7 +30,7 @@
 %       *   First reasonable release
 %
 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\ProvidesClass{byumsphd}[2007/03/09 BYU LaTeX MS/PhD Class]
+\ProvidesClass{byumsphd}[2006/03/10 BYU LaTeX MS/PhD Class]
 %
 % Boolean option creation
 \newif\if@thesis % generates \if@thesis, \@thesistrue, and \@thesisfalse
@@ -288,7 +277,6 @@
 % default values for their corresponding @-less versions.
 \newcommand{\@university}{Brigham Young University}
 \newcommand{\@department}{Computer Science}
-\newcommand{\@departmentprefix}{Department of}
 \newcommand{\@graduatecoordinator}{Parris~K.~Egbert}
 \newcommand{\@college}{College of Physical and Mathematical Sciences}
 \newcommand{\@collegedean}{Thomas~W.~Sederberg}
@@ -313,7 +301,6 @@
 % have suitable defaults.
 \newcommand{\university}[1]{\renewcommand{\@university}{#1}}
 \newcommand{\department}[1]{\renewcommand{\@department}{#1}}
-\newcommand{\departmentprefix}[1]{\renewcommand{\@departmentprefix}{#1}}
 \newcommand{\graduatecoordinator}[1]{\renewcommand{\@graduatecoordinator}{#1}}
 \newcommand{\college}[1]{\renewcommand{\@college}{#1}}
 \newcommand{\collegedean}[1]{\renewcommand{\@collegedean}{#1}}
@@ -452,6 +439,7 @@
 % Title page
 \renewcommand{\titlepage}{%
     \clearpage
+    \pdfbookmark[1]{Title Page}{title}
     {\parindent 0pt%
     {\centering
     \vspace*{\@prefacemargingapdouble}%
@@ -479,7 +467,7 @@
     \vfill
     \vfill
         \begin{doublespace}%
-            {\@departmentprefix} {\@department} \\%
+            Department of \@department \\%
             \@university\\%
             {\@monthsubmitted} {\@yearsubmitted}%
         \end{doublespace}%
@@ -504,6 +492,7 @@
 %
 \newcommand{\abstractpage}{%
     \clearpage
+    \pdfbookmark[1]{Abstract}{abstract}
     {\centering
     \parindent 0pt%
     \vspace*{\@prefacemargingapdouble}%
@@ -517,7 +506,7 @@
     \vspace{3\@blankline}\par
     \begin{doublespace}%
         {\@author}\\%
-        {\@departmentprefix} {\@department}\\%
+        Department of {\@department}\\%
         \@degreename
     \end{doublespace}%
     \vspace{3\@blankline}\par
@@ -544,6 +533,7 @@
 %
 \renewcommand{\tableofcontents}{%
     \clearpage
+    \pdfbookmark[1]{Table of Contents}{toc}
     \@tocheader{\contentsname}%
     \thispagestyle{plain}%
     \@starttoc{toc}%
@@ -552,6 +542,7 @@
 %
 \renewcommand{\listoffigures}{%
     \clearpage
+    \pdfbookmark[1]{List of Figures}{lof}
     \@tocheader{\listfigurename}%
     \@starttoc{lof}%
     \newpage
@@ -559,6 +550,7 @@
 %
 \renewcommand{\listoftables}{%
     \clearpage
+    \pdfbookmark[1]{List of Tables}{lot}
     \@tocheader{\listtablename}%
     \@starttoc{lot}%
     \newpage

Original comment by shiblon on 10 Mar 2007 at 4:27

GoogleCodeExporter commented 9 years ago
A quick comment, now that I've looked at the patch.  It looks like it is a bit 
out of
date, which isn't terribly surprising (missing some of the newer commands I 
added
recently).  Those lines that begin with - should be ignored unless they are
immediately followed by a +.  In fact, the patch is very small (that part that
matters).  I am considering regenerating it.

Here is the new, more sensible-looking patch:

Index: byumsphd.cls
===================================================================
--- byumsphd.cls    (revision 2)
+++ byumsphd.cls    (working copy)
@@ -452,6 +452,7 @@
 % Title page
 \renewcommand{\titlepage}{%
     \clearpage
+    \pdfbookmark[1]{Title Page}{title}
     {\parindent 0pt%
     {\centering
     \vspace*{\@prefacemargingapdouble}%
@@ -504,6 +505,7 @@
 %
 \newcommand{\abstractpage}{%
     \clearpage
+    \pdfbookmark[1]{Abstract}{abstract}
     {\centering
     \parindent 0pt%
     \vspace*{\@prefacemargingapdouble}%
@@ -544,6 +546,7 @@
 %
 \renewcommand{\tableofcontents}{%
     \clearpage
+    \pdfbookmark[1]{Table of Contents}{toc}
     \@tocheader{\contentsname}%
     \thispagestyle{plain}%
     \@starttoc{toc}%
@@ -552,6 +555,7 @@
 %
 \renewcommand{\listoffigures}{%
     \clearpage
+    \pdfbookmark[1]{List of Figures}{lof}
     \@tocheader{\listfigurename}%
     \@starttoc{lof}%
     \newpage
@@ -559,6 +563,7 @@
 %
 \renewcommand{\listoftables}{%
     \clearpage
+    \pdfbookmark[1]{List of Tables}{lot}
     \@tocheader{\listtablename}%
     \@starttoc{lot}%
     \newpage

Original comment by shiblon on 10 Mar 2007 at 4:34

GoogleCodeExporter commented 9 years ago
I just looked at the output of my own dissertation, which was built without the
patch, and it looks like it did not, in fact, have bookmarks for the sections 
that
have been fixed above.  This is either a new requirement, or they missed it 
when I
submitted.

It looks like something needs to be done to fix it.  I'll try compiling with the
patch, and if it works, I'll submit it.

Original comment by shiblon on 10 Mar 2007 at 4:41

GoogleCodeExporter commented 9 years ago
Made the necessary adjustments.  The original patch only works if hyperref is
included, so I created a fake \@@pdfbookmark command that only calls the 
original
when it exists, otherwise it is a no-op.  I also updated the example file.

Index: byumsphd-example.tex
===================================================================
--- byumsphd-example.tex    (revision 3)
+++ byumsphd-example.tex    (working copy)
@@ -1,4 +1,8 @@
 \documentclass[letterpaper,phd,prettyheadings,chaptercenter,parttop]{byumsphd}
+% Author: Chris Monson
+%
+% This document is in the public domain
+%
 % Options for this class include the following (* indicates default):
 %
 %   letterpaper -- ignored, but helpful for the Makefile that I use
@@ -62,8 +66,8 @@
 % out if these already exist.
 \newcommand{\Title}{BYU MS/PhD {\LaTeX} Class Dissertation Example}
 \newcommand{\Author}{Christopher K. Monson}
-\newcommand{\GraduationMonth}{March}
-\newcommand{\GraduationYear}{2006}
+\newcommand{\SubmissionMonth}{March}
+\newcommand{\SubmissionYear}{2006}

 % Set up the internal PDF information so that it becomes part of the document
 % metadata.  The pdfinfo command will display this.
@@ -71,7 +75,7 @@
     pdftitle=\Title,%
     pdfauthor=\Author,%
     pdfsubject={PhD Dissertation, BYU CS Department: %
-                Degree Granted \GraduationMonth~\GraduationYear, Document 
Created
\today},%
+                Degree Granted \SubmissionMonth~\SubmissionYear, Document 
Created
\today},%
     pdfkeywords={BYU, thesis, dissertation, LaTeX},%
 }

@@ -95,9 +99,9 @@
 \committeememberc{Attends A. Meeting}
 \committeememberd{Will B. Present}

-\monthgraduated{\GraduationMonth}
-\yeargraduated{\GraduationYear}
-\yearcopyrighted{\GraduationYear}
+\monthsubmitted{\SubmissionMonth}
+\yearsubmitted{\SubmissionYear}
+\yearcopyrighted{\SubmissionYear}

 \documentabstract{%
     This document is an example of how to use the byumsphd {\LaTeX} class file.  The
class creates Ph.D. and Master's documents equally well, producing all 
appropriate
preamble content and adhering precisely to the minimum formatting requirements. 
 It
is meant to replace the old ECEn style file that has been circulating for many 
years.
@@ -198,13 +202,13 @@
     \item \verb|\committeememberb{<third member>}|
     \item \verb|\committeememberc{<fourth member (PhD only)>}|
     \item \verb|\committeememberd{<fifth member (PhD only)>}|
-    \item \verb|\monthgraduated{<month of graduation>}|
-    \item \verb|\yeargraduated{<hopefully this year>}|
+    \item \verb|\monthsubmitted{<month of submission>}|
+    \item \verb|\yearsubmitted{<hopefully this year>}|
     \item \verb|\documentabstract{<your thesis abstract goes here>}|
 \end{itemize}
 The following are optional or have defaults suitable for CS majors:
 \begin{itemize}
-    \item \verb|\yearcopyrighted{<defaults to year graduated>}|
+    \item \verb|\yearcopyrighted{<defaults to year submitted>}|
     \item \verb|\acknowledgments{<the text of your acknowledgments goes here>}|
     \item \verb|\university{<default: Brigham Young University>}|
     \item \verb|\department{<default: Computer Science>}|
Index: byumsphd.cls
===================================================================
--- byumsphd.cls    (revision 3)
+++ byumsphd.cls    (working copy)
@@ -26,9 +26,14 @@
 % send those to the author as well so that this class has a single point of
 % distribution and all may benefit.
 %
-% Version: 1.0.4
+% Version: 1.0.5
 %
 % Changelog:
+%   Chris Monson (2007-03-10):
+%       *   Bumped version to 1.0.5
+%       *   Addressed issue (2) on code.google.com/p/latex-byu-thesis as 
follows
+%       *   Created a fake pdfbookmark command that switches on with hyperref
+%       *   Inserted pdfbookmark commands per Dan Delorey (new requirements)
 %   Chris Monson (2007-03-09):
 %       *   Bumped version to 1.0.4
 %       *   Added the LGPL as an alternate license
@@ -42,7 +47,7 @@
 %       *   First reasonable release
 %
 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\ProvidesClass{byumsphd}[2007/03/09 BYU LaTeX MS/PhD Class]
+\ProvidesClass{byumsphd}[2007/03/10 BYU LaTeX MS/PhD Class]
 %
 % Boolean option creation
 \newif\if@thesis % generates \if@thesis, \@thesistrue, and \@thesisfalse
@@ -61,6 +66,16 @@
 \newcommand{\@@openval}{openright}
 \newcommand{\@@ptsize}{12pt}

+% This is an empty no-op command in case pdfbookmark is not defined (hyperref
+% not included)
+\newcommand{\@@pdfbookmark}[3][1]{%
+  \ifx\pdfbookmark\undefined
+    \relax
+  \else
+    \pdfbookmark[#1]{#2}{#3}%
+  \fi
+}%
+
 %
 % This document can serve as either a PhD dissertation or a Master's thesis
 \DeclareOption{compliantheadings}{\@compliantsizestrue}
@@ -453,6 +468,7 @@
 % Title page
 \renewcommand{\titlepage}{%
     \clearpage
+    \@@pdfbookmark[1]{Title Page}{title}%
     {\parindent 0pt%
     {\centering
     \vspace*{\@prefacemargingapdouble}%
@@ -505,6 +521,7 @@
 %
 \newcommand{\abstractpage}{%
     \clearpage
+    \@@pdfbookmark[1]{Abstract}{abstract}%
     {\centering
     \parindent 0pt%
     \vspace*{\@prefacemargingapdouble}%
@@ -545,6 +562,7 @@
 %
 \renewcommand{\tableofcontents}{%
     \clearpage
+    \@@pdfbookmark[1]{Table of Contents}{toc}%
     \@tocheader{\contentsname}%
     \thispagestyle{plain}%
     \@starttoc{toc}%
@@ -553,6 +571,7 @@
 %
 \renewcommand{\listoffigures}{%
     \clearpage
+    \@@pdfbookmark[1]{List of Figures}{lof}%
     \@tocheader{\listfigurename}%
     \@starttoc{lof}%
     \newpage
@@ -560,6 +579,7 @@
 %
 \renewcommand{\listoftables}{%
     \clearpage
+    \@@pdfbookmark[1]{List of Tables}{lot}%
     \@tocheader{\listtablename}%
     \@starttoc{lot}%
     \newpage

Original comment by shiblon on 10 Mar 2007 at 5:24

GoogleCodeExporter commented 9 years ago
This should now be fixed in version 1.0.5, checked in tonight.  I believe there 
is an
outstanding issue with BIB links?  If so, create another bug for those.  I'm 
marking
this as fixed.  Dan, please verify that it is, in fact, fixed for you.

Original comment by shiblon on 10 Mar 2007 at 5:27

GoogleCodeExporter commented 9 years ago
I have tested this on Windows using the most recent release of MikTeX (as of 
3/10/2007) and pdflatex from WinEdt 5.4 and it adds all the correct bookmarks 
except 
for the References/Bibliography section. I'll begin a new issue describing my 
current workaround for that.

Original comment by dandelo...@gmail.com on 10 Mar 2007 at 2:44