The bibliography in my document is "incorporating" the appendices in the TOC and the bookmark structure using hyperref. The page number in TOC for Bibliography is also bigger than all other page numbers and it's really annoying.

This is a new independent post of part of lyx hyper-ref toc appendix and bibliography and A.0.1 figure labels in Appendix. I thought it was worth separating since it is a different issue than the other things posted with.

here is an MWE with custom class file I'm using for my thesis. both a lyx and .tex file here

There are a couple of things wrong with your sample file, and one thing wrong with your class file.

First, your testfile has the following code:

\appendix
\appendices


This is incorrect. Since you are using the appendix package, you should use the appendices environment (it's not a macro.) However, because your class file does some funny things with the appendix command, you need to add some code after the \begin{appendices} line to make the appendices show up with letters: So you should have:

\begin{appendices}
\makeatletter
\renewcommand*{\th@DefTheChapter}{\Alph{chapter}}
\makeatother
...
\end{appendices}


Furthermore, (although this isn't apparent in the output) your use of the \begin{thebibliography} environment is incorrect. You have:

\begin{thebibliography}{Bibliography}


But the argument of the thebibliography environment is not the title (this is generated automatically) but a string representing the largest label you will have. Since you are using a numeric bibliography style, you should use something like the following:

 \begin{thebibliography}{99} % assuming you have less than 100 references


(I'm assuming you are using natbib and bibtex to do your actual bibliography instead of doing it by hand.)

The reason your bibliography looks wrong (including the page number) is because your class file makes its title in the table of contents a part level instead of a chapter level. This can be fixed by putting the following code after the begin document (i.e. not in the preamble.)

(Alternatively, you can simply fix this code in your version of the class file itself, in which case you don't need to add the code to your document and you shouldn't wrap the code in \makeatletter/makeatother.)

\makeatletter
\renewenvironment*{thebibliography}[1]{
\begin{th@OldBib}{#1}
\ULforem%  set \em to underline
\begin{singlespace}
\addcontentsline{toc}{chapter}{\bibnameToC} % changed from part to chapter
}{
\end{singlespace}
\EmphReset% set \em back to the user-specified default.
\end{th@OldBib}
}
\makeatother


(This definition is quite awful. Does your university really require you to use underlining instead of italics?)

There's also a spurious space in the TOC entry for the bibliography. This is caused by the an extra space in the following definition in the class file (line 389):

\newcommand*{\bibnameToC}{% put a comment marker here to remove the space
\normalsize\th@HdFnt Bibliography\normalfont}

• Thank you Thank you Thank you! Two small pieces to clarify: 1. is the \makeatletter needed in the .cls? or just in the document? eitherway, it works in the .cls but produced an error when placed after \begin{document}. 2. not sure what spurious space you mentioned but I made the recommended change although I didn't notice anything – Dominik Apr 26 '11 at 14:38
• as for the other items, I will keep in mind about the appendices even though it still works (?) and the underlining I don't know what it's underlining. might have to do with the fact that I copied the citations in because I only moved from Word to latex a month ago. – Dominik Apr 26 '11 at 14:40
• @Dominik, you shouldn't use \makeatletter/\makeatother inside a class or package, only in a document file. It should not produce an error in your document file (I forgot to add the \makeatother) at the end of the sample code, although I don't think that should have caused an error. Even though things appear to work, they may cause you problems down the line, so you should fix the \appendices issue. (I.e. put the chapter(s) that are your appendices inside the `\begin{appendices}...\end{appendices} environment.). – Alan Munn Apr 26 '11 at 14:41
• Ok. appendices fixed. THanks again for your help. – Dominik Apr 26 '11 at 14:54
• If I may I'd like to ask a somewhat related question: How would I change the hyperref bookmarks to display Appendix <letter> or Appendix <letter> <title> instead of Appendix <title>? – Dominik Apr 26 '11 at 15:08