# Separate table of appendices - pdf bookmarks & avoid previous chapter's format

I'm trying to format my thesis which requires a seperate list of appendices. Thanks to a really useful post - Creating a separate list of appendices with tocloft - I have the list up and running. I'm using my university thesis class (ut-thesis) which from my understanding is based on the report class.

My questions (and yes I am a complete newbie) are, given the setup at the answer above:

1. How can get the appendices to show up as PDF bookmarks? The hyperlink from the list to the page is already working. I'm just missing the bookmark.
2. My appendices have the previous section's header (Bibliography) starting from the second page of the chapter. How can I have this be the correct Appendix X heading?

Here is the code from that previous post. The only modification I made was to change the section to chapter (as the UTthesis.cls has chapters) and subsection to section. It is included as a separate file called commands.

\newcommand{\listappendixname}{List of Appendices}
\newlistof{appendix}{app}{\listappendixname}
\setcounter{appdepth}{2}
\renewcommand{\theappendix}{\Alph{appendix}}
\renewcommand{\cftappendixpresnum}{Appendix\space}
\setlength{\cftbeforeappendixskip}{\baselineskip}
\setlength{\cftappendixnumwidth}{1in}
\newlistentry[appendix]{subappendix}{app}{1}
\renewcommand{\thesubappendix}{\theappendix.\arabic{subappendix}}
\renewcommand{\cftsubappendixpresnum}{Appendix\space}
\setlength{\cftsubappendixnumwidth}{1in}
\setlength{\cftsubappendixindent}{0em}

\newcommand{\myappendix}[1]{%
\refstepcounter{appendix}%
\chapter*{Appendix \theappendix\space #1}%
\par
}

\newcommand{\subappendix}[1]{%
\refstepcounter{subappendix}%
\section*{\thesubappendix\space #1}%
}


Also if it is helpful here is an example of my appendix file called JaccardCode

\myappendix{Code for Extension of Measure}
\begin{lstlisting}
code
\end{lstlisting}


And finally here is a stripped down version of my main file. My apologies if I included too much information, as a newbie I just wasn't sure what would be useful.

\documentclass[]{ut-thesis}

\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{tocloft}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{subfig}
\usepackage{listings}

\usepackage{xr-hyper}

\degree{Doctor of Philosophy}
\department{Computer Science}
\author{Fran\c{c}ois Pitt}
\title{UT-Thesis Class File Example}

\setcounter{tocdepth}{2}

\begin{document}

\input{commands}

\begin{preliminary}

\maketitle

\begin{abstract}

\end{abstract}

\tableofcontents
\listoftables
\listoffigures
\listofmyequations
\listofappendix

\end{preliminary}

\include {Introduction}
\include {RelatedLit}
\include {ObjectiveI}
\include {ObjectiveII}
\include {ObjectiveIII}
\include {ObjectiveIV}
\include {Conclusion}

\bibliographystyle{vancouver}
\bibliography{thesis}

\include{JaccardCode}
\end{document}


• Rather use the following order/code to include your appendix:

\clearpage \phantomsection
\include{JaccardCode}


It will ensure correct hyper-referencing from the bookmarks panel in your PDF viewer. \phantomsection is provided by hyperref.

• A similar approach should be used for your \myappendix and \subappendix macros. That is, establish a \phantomsection (for correct hyper-referencing), and add the PDF bookmark using \pdfbookmark[<level>]{<text>}{<name>}. The latter call to \pdfbookmark suffices since it also places a hyper anchor like \phantomsection does:

\newcommand{\myappendix}[1]{%
\refstepcounter{appendix}\pdfbookmark[1]{#1}{#1\theappendix}%
\chapter*{Appendix \theappendix\space #1}%
\par
}

\newcommand{\subappendix}[1]{%
\refstepcounter{subappendix}\pdfbookmark[2]{#1}{#1\thesubappendix}%
\section*{\thesubappendix\space #1}%
}


In the above code, I've placed \myappendix at the "section level" (<level> is 1), while \subappendix is placed at the "subsection level" (<level> is 2). This is because you already add the Appendix to your Table of Contents at the "chapter level" (which is level 0). So, in order to show some hierarchy, I've used 1 and 2.

More on adding PDF bookmarks may be found in the hyperref documentation.

• In order to modify the headings to be the same as your Appendix heading (and not "grab" the previous header), extend the above \myappendix to

\newcommand{\myappendix}[1]{%
\refstepcounter{appendix}\pdfbookmark[1]{#1}{#1\theappendix}%
\chapter*{Appendix \theappendix\space #1}%

This uses \markboth{<left>}{<right>} to format the <right> header in uppercase. Since you're using a oneside document, no need to format the <left> header. You could, if needed, format the <left> header to contain your \subappendix details. However, without more information on how \myappendix and \subappendix works together in your document, it's difficult to assess what you're after here.
• +1, and I'm considering to delete my answer. Small suggestion: In oneside mode, \chaptermark actually uses \markright (at least in the report class). – lockstep Jan 3 '12 at 0:27