3

I'm fairly new to LaTeX and need help with the number of figures in appendices in the table of figures. Currently, they are just numbered,

  1. Figure caption ............ p193

but I'd like them to appear as

A.1. Figure caption ......... p193

This is for my dissertation, and I've inherited some formatting code from previous graduate students. The MWE is:

\documentclass[12pt]{report}

\usepackage[demo]{graphicx}

\newcommand{\APPENDIX}[2]{%
\refstepcounter{chapter}%
\addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}: #2}%
\pagestyle{plain}%
\thispagestyle{plain}%
\singlespace%
\begin{center}% 
\large
\textbf{Appendix #1: #2}\\%
\normalsize
\end{center}%
\doublespace%
\vspace{1em}}

\begin{document}

\tableofcontents

\listoffigures

\newpage
\appendix
\appendix{A}{TITLE OF APPENDIX}

\begin{figure}
\includegraphics{dummy}
\caption{dummy caption}
\end{figure}

\end{document}

Thanks in advance!

1

I'd suggest you a different approach. Using a manual formatting for your appendices implies too much work: you'll have to correct counters, marks, ToC entries, amongst others. Instead, you can use the titlesec package to easily change the chapter format in appendices, allowing you to use \chapter for your appendices and thus solving automatically all problems mentioned above; in particular, you recover the desired numbering for floats in the appendices.

In comments it has been mentioned that a colon must appear between the number and the title for ToC entries corresponding to appendices, and that chapter and section entries should have leading dots; this can be achieved with the help of the titletoc package.

\documentclass[12pt]{report}
\usepackage[demo]{graphicx}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{setspace}
\usepackage{etoolbox}

\newcommand\AppChap{%
\titleformat{\chapter}[block]
  {\normalfont\large\bfseries\filcenter}{\appendixname\ \thechapter:}{1em}{}
\titlespacing*{\chapter}
  {0pt}{-20pt}{1em}
\titlecontents{chapter}
  [1.5em]{\vspace{10pt}\bfseries}
  {\contentslabel[\thecontentslabel:]{1.3em}}
  {\hspace*{-1.3em}}
  {\titlerule*[0.8em]{.}\contentspage}
}
\titlecontents{chapter}
  [1.5em]{\vspace{10pt}\bfseries}
  {\contentslabel{1.25em}}
  {\hspace*{-1.25em}}
  {\titlerule*[10pt]{.}\contentspage}
\titlecontents{section}
  [3.8em]{}
  {\contentslabel{2.3em}}
  {\hspace*{-2.3em}}
  {\titlerule*[10pt]{.}\contentspage}

\apptocmd{\appendix}{\AppChap}{}{}

\begin{document}

\tableofcontents
\listoffigures

\chapter{A regular chapter}
\section{A regular section}
\newpage
\appendix
\chapter{TITLE OF APPENDIX}
\section{A section in appendix}
\begin{figure}
\includegraphics{dummy}
\caption{dummy caption}
\end{figure}

\end{document}

An image of the ToC:

enter image description here

An image of the LoF:

enter image description here

  • That works well! The only problem it gives me is that the colon after "A" in the table of contents disappears (have to add \tableofcontents to MWE to see it) – lmxb Aug 29 '13 at 22:57
  • @lmxb please see my updated answer. – Gonzalo Medina Aug 29 '13 at 23:11
  • One last question, then I'll leave you alone. I need to have dots after the chapter and section titles leading to the page number. I was accomplishing this with \renewcommand{\cftdot}{\normalfont.} but now the dots are gone. I tried putting this into the definition of AppChap, to no avail. – lmxb Aug 30 '13 at 4:09
  • I've also tried using \renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} (found in other thread) both before, after, and inside the definition of AppChap, but it doesn't help either. – lmxb Aug 30 '13 at 5:55
  • @lmxb no need for tocloft; you can do all this with titletoc, instead. See my updated answer. – Gonzalo Medina Aug 30 '13 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.