4

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}%
  \addcontentsline{app}{appendix}{\protect\numberline{\theappendix}#1}%
  \par
}

\newcommand{\subappendix}[1]{%
  \refstepcounter{subappendix}%
  \section*{\thesubappendix\space #1}%
  \addcontentsline{app}{subappendix}{\protect\numberline{\thesubappendix}#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}
\usepackage[colorlinks=true, allcolors=black]{hyperref}

\degree{Doctor of Philosophy}
\department{Computer Science}
\gradyear{1999}
\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}


\addcontentsline{toc}{chapter}{Bibliography}
\bibliographystyle{vancouver}
\bibliography{thesis}

\include{JaccardCode}
\addcontentsline{toc}{chapter}{Appendices}
\end{document}

1 Answer 1

8

Here are some broad-stroke suggestions:

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

    \clearpage \phantomsection
    \addcontentsline{toc}{chapter}{Appendices}
    \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}%
      \addcontentsline{app}{appendix}{\protect\numberline{\theappendix}#1}%
      \par
    }
    
    \newcommand{\subappendix}[1]{%
      \refstepcounter{subappendix}\pdfbookmark[2]{#1}{#1\thesubappendix}%
      \section*{\thesubappendix\space #1}%
      \addcontentsline{app}{subappendix}{\protect\numberline{\thesubappendix}#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}%
      \addcontentsline{app}{appendix}{\protect\numberline{\theappendix}#1}%
      \markboth{}{\MakeUppercase{Appendix\ \theappendix\space #1}}\par
    }
    

    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.

  • One general comment:

    It is always best to post complete, compilable, minimal code. For more on this, see I've just been told I have to write a minimal example; What is that? Even if you have an entire thesis that has some problems you want help with, extract just the necessary components and post that. This is the best and most complete way of getting help. Make sure, however, that there are no conflicts between packages you've removed in order to obtain your minimal example. If they do arise through posted solutions, then you can updated your original post to reflect these changes.

3
  • +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, 2012 at 0:27
  • simply swapping \chaptermark{} in this case gives just "APPENDIX" in the header as opposed to "Appendix A Code for Extension of Measure". I'm not sure exactly why it is in italics but I guess that's fine for now.
    – user10425
    Jan 3, 2012 at 19:38
  • @user10425: Did I suggest that? Either way, your question won't be seen by many people here, so it would be best to repost it as a follow-up question. Such questions are more than welcome! Please use the "Ask Question" link for your new question; there you can link to this question to provide the background.
    – Werner
    Jan 3, 2012 at 20:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .