I implemented the instructions found in this forum (link here) to add a separate List of Appendices, as requested by my university. The list should be placed right after the List of Abbreviations as in the picture below:
In order to achieve this, I added the following macro:
\newcounter{dlf}
\newcommand\test{%
\stepcounter{dlf}
\chapter{Test chapter \thedlf}
\section{test section \thedlf}}
\cftinsertcode{preapp}{\setcounter{tocdepth}{-10}}
\newcommand\apptoc{
\begingroup
\cftinsertcode{prenorm}{\setcounter{tocdepth}{-10}}
\cftinsertcode{preapp}{\setcounter{tocdepth}{3}}
\renewcommand\contentsname{List of Appendices}
\tableofcontents*
\endgroup
}
then I inserted this code right after the Abbreviations section:
\apptoc
\addcontentsline{toc}{chapter}{List of Appendices}
\cftinserthook{toc}{prenorm}
and then, finally, I added after \begin{appendices}
\appendix
\appendixpage
\cftinserthook{toc}{preapp}
It works pretty well, but both the bibliography and the index have now disappeared from the Table of Contents. They are placed at the end of the List of Appendices. (see picture below) The question is: How do I place them back into the ToC?
here is a MWE:
\documentclass[12pt,letterpaper,oneside,final]{memoir}
\usepackage[no-math]{fontspec}
\usepackage{xltxtra}
\usepackage{xkeyval}
\usepackage{polyglossia}
\usepackage{type1cm}
\usepackage{graphicx}
\usepackage[rightcaption]{sidecap}
\usepackage{float}
\usepackage{url}
\usepackage[normalem]{ulem}
\usepackage{siunitx}
\usepackage{textcomp}
\usepackage{makeidx}
\setdefaultlanguage[variant=american]{english}
\setotherlanguage[variant=ancient,numerals=arabic]{greek}
\setotherlanguage[spelling=new]{german}
\setotherlanguages{french,italian,spanish}
\usepackage{csquotes}
\usepackage{etoolbox,keyval,ifthen}
\usepackage[backend=biber]{biblatex-chicago}
\usepackage{booktabs}
\usepackage{array}
\usepackage[series={},nocritical,noend,noeledsec,nofamiliar,noledgroup]{reledmac}
\usepackage{reledpar}
\setlength{\columnrulewidth}{0.4pt}
%\DeclareAutoCiteCommand{plain}{\cite}{\cites}
\DeclareAutoCiteCommand{plain}{\textcite}{\textcites}
\DeclareAutoCiteCommand{inline}{\textcite}{\textcites}
\DeclareAutoCiteCommand{footnote}[l]{\footcite}{\footcites}
%\DeclareAutoCiteCommand{footnote}[f]{\smartcite}{\smartcites}
\bibliography{masterbib}
\usepackage[final]{hyperref}%?%hyperfootnotes=false
\hypersetup{bookmarks=false, % show bookmarks bar?
unicode=true, % non-Latin characters in Acrobat’s bookmarks
pdftoolbar=true, % show Acrobat’s toolbar?
pdfmenubar=true, % show Acrobat’s menu?
pdffitwindow=false, % window fit to page when opened
pdfstartview={FitH}, % fits the width of the page to the window
pdftitle={},
pdfauthor={}, % author
pdfsubject={Ph.D. Dissertation}, % subject of the document
pdfcreator={}, % creator of the document
pdfproducer={}, % producer of the document
pdfkeywords={}, % list of keywords
pdfnewwindow=true, % links in new window
colorlinks=true, % false: boxed links; true: colored links
linkcolor=black, % color of internal links
citecolor=black, % color of links to bibliography
filecolor=black, % color of file links
urlcolor=black % color of external links
}
\usepackage{microtype}
\usepackage{xecolor}
\definergbcolor{blue}{0000FF}
\definergbcolor{red}{FF0000} %\textxecolor{colorname}{text}
\XeTeXdashbreakstate=1
%\usepackage{indentfirst}
\usepackage{outline}
%\usepackage{verbatim}
\usepackage{enumerate}
\usepackage{longtable}
\usepackage{ccicons}
\usepackage{bookmark}
\usepackage{etoolbox}
\usepackage{lscape}
\epigraphfontsize{\small\itshape}
\setlength\epigraphwidth{8cm}
\setlength\epigraphrule{0pt}
%!%%%%%%%%%%%%%%%%%%%%%for non-italicized headings%%%%%
% http://tex.stackexchange.com/questions/32655/remove-italic-from-memoir-headings-pagestyle
\makeevenhead{headings}{\leftmark}{}{}
\makeoddhead{headings}{\rightmark}{}{}
\makeevenfoot{headings}{}{\thepage}{}
\makeoddfoot{headings}{}{\thepage}{}
%!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%!%%%%%%%%%%%%%%%%%%%%%for margins, l=1.5; rest=1.0, maybe add 0.1in%%%%%
\setstocksize{11in}{8.5in}
\settrimmedsize{11.0in}{8.5in}{*} %\settrimmedsize{ height }{ width }{ ratio }
\settypeblocksize{7.75in}{5.8in}{*} %\settypeblocksize{ height }{ width }{ ratio } %note: 7.25h gives margins of 1.5 on top/bottom w/ ubratio of 1
\setlrmargins{1.5in}{*}{*} %\setlrmargins{ spine }{ edge }{ ratio } %spine = left, edge = right; only answer one or two of these values
%\setlrmarginsandblock{1.5in}{1.0in}{*} %\setlrmarginsandblock{ spine }{ edge }{ ratio } %
%\setulmargins{*}{*}{*} %\setulmargins{ upper }{ lower }{ ratio }
%\setulmarginsandblock{0.5in}{*}{*} %\setulmarginsandblock{ upper }{ lower }{ ratio }
%\setheadfoot{*}{*} %\setheadfoot{ headheight }{ footskip }
%\setheaderspaces{1.0in}{*}{*} %\setheaderspaces{ headdrop }{ headsep }{ ratio }
%\checkandfixthelayout[lines]
\flushbottom
%!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\apptocmd{\sloppy}{\hbadness 10000\relax}{}{}
\setsecnumdepth{subparagraph}
\makeatletter
\renewcommand\@makefntext{\hspace*{2em}\@thefnmark. }
\newenvironment*{singlespcquote}
{\quote\SingleSpacing}
{\endquote}
\SetBlockThreshold{0}
\SetBlockEnvironment{singlespcquote}
\SetCiteCommand{\parencite} %default is \cite
\makeindex
%%%%%%%%%%%%List of Appendices Macro%%%%%%%%%%%%
\newcounter{dlf}
\newcommand\test{%
\stepcounter{dlf}
\chapter{Test chapter \thedlf}
\section{test section \thedlf}}
\cftinsertcode{preapp}{\setcounter{tocdepth}{-10}}
\newcommand\apptoc{
\begingroup
\cftinsertcode{prenorm}{\setcounter{tocdepth}{-10}}
\cftinsertcode{preapp}{\setcounter{tocdepth}{3}}
\renewcommand\contentsname{List of Appendices}
\tableofcontents*
\endgroup
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{kantlipsum}
\begin{document}
%\fussy
%\hyphenpenalty=5000 %1000 default=?
%\tolerance=1000 %1000 %200= default
%\setlength{\emergencystretch}{3em}
%\midsloppy
\fussy
\vbadness=10000 % badness above which bad vboxes are shown. (Default = 10000?)
\frontmatter
\hyphenation{}
\DoubleSpacing
\begin{center}
\thispagestyle{empty}
Title of the Dissertatio
\vspace{20mm}
by\\
\vspace{10mm}
xxxxxx xxxxxx\\
\vspace{10mm}
A dissertation submitted in partial fulfillment\\
of the requirements for the degree of\\
Doctor of Philosophy\\
Department ...\\
New York University\\
September, 2017
\end{center}
\vspace{35mm}
\begin{flushright}
{\rule[0pt]{45mm}{0.1mm}}\\ %rule[raise-height]{width}{height} * raise-height specifies how high to raise the rule (optional) * width specifies the length of the rule (mandatory) * height specifies the height of the rule (mandatory)
Prof. xxxxx
\end{flushright}
\newpage
\thispagestyle{empty}
\begin{center} © xxxxxxx \\ All Rights Reserved, 2017\end{center}
\newpage
\thispagestyle{empty}
\chapter{Dedication}
dedication
\DoubleSpacing
\newpage
\chapter{Acknowledgments}
acknowledgments
\newpage
\chapter{Abstract}
\DoubleSpacing
abstract
\newpage
\renewcommand*{\cftappendixname}{Appendix\space}
\renewcommand*{\contentsname}{Table of Contents}
\setcounter{tocdepth}{2}% chapters and above
%this removes TOC listing from TOC
\begin{KeepFromToc}
\tableofcontents
\end{KeepFromToc}
\clearpage
\newpage
\clearpage
\listoffigures
\chapter{List of Abbreviations}
\SingleSpacing
\begin{longtable}{ll}
\emph{ASFi} & Archivio di Stato di Firenze\\
\emph{ASMn} & Archivio di Stato di Mantova\\
\emph{ASPi} & Archivio di Stato di Pisa\\
\emph{ASVe}& Archivio di Stato di Venezia\\
\emph{ASVr}& Archivio di Stato di Verona\\
\emph{AG} & Archivio Gonzaga\\
\emph{AN} & Archivio Notarile\\
\emph{PM} & Principato Mediceo\\
\emph{BUPi} & Biblioteca Universitaria di Pisa\\
\emph{BCTr} & Biblioteca Comunale di Trento\\
\emph{BUBo} & Biblioteca Universitaria di Bologna\\
\emph{BNM} & Biblioteca Nazionale Marciana\\
\emph{BNCFi} & Biblioteca Nazionale Centrale di Firenze\\
\emph{BnF} & Bibliothèque nationale de France\\
\emph{BNE} & Biblioteca Nacional de España\\
\emph{BSB} & Bayerische Staatsbibliothek\\
\emph{BAV} & Biblioteca dell'Accademia Virgiliana\\
\emph{IdF} & Institut de France\\
\emph{RVF} & Rerum Vulgarium Fragmenta \\
\end{longtable}
\clearpage
\apptoc
\addcontentsline{toc}{chapter}{List of Appendices}
\cftinserthook{toc}{prenorm}
\DoubleSpacing
\mainmatter
\clearpage
\cleardoublepage
\phantomsection
\chapter[Introduction]{Introduction}
\kant[1-2]
\chapter{Chapter1}
\index{chapter one}chapter one
\kant[1-2]
\chapter{Chapter 2}
\index{chapter two}chapter two
\kant[1-2]
\chapter{Chapter 3}
\kant[1-2]
\chapter{Chapter 4}
\kant[1-2]
\chapter[Conclusion]{Conclusion}
%%%%%%%% Appendices %%%%%%%%%%%%%
\begin{appendices}
\appendix
\appendixpage
\cftinserthook{toc}{preapp}
\chapter{Appendix a}
\kant[1-2]
\section{more Kant}
\kant[1-2]
\section{even more kant}
\kant{1-2}
\chapter{Appendix b}
\kant[1-2]
\chapter{Appendix c}
\kant[1-2]
\chapter{Appendix d}
\kant[1-2]
\end{appendices}
\newpage
\clearpage
\backmatter
\begin{OnehalfSpace}
\setlength{\bibitemsep}{\onelineskip}
\chapter{Bibliography}
\kant
\printindex
\end{OnehalfSpace}
\end{document}
Best Answer
This method uses 'fake'
.toc
file handles by starting a new.app
ToC.First some explanation what goes wrong with the OP code:
The code from the O.P. effectively closes the
.toc
file prematurely and adds the following contents like the Bibliography ToC entry or the Index ToC entry to the Appendix ToC -- there is no chance to get them over to the real.toc
.Now here is another approach:
Before
\appendices
starts in calls the\listofappendices
macro that inserts its name to the general ToC but uses the.app
file instead of.toc
.From this position, all entries should go to the
.app
file and not to the.toc
, so\let\tf@toc\tf@app
is used, i.e. the file handles are changed.At
\endappendices
, the original file handles are restored such that any other content goes back to the original.toc
.This solution is similar to another answer I gave here: How to have separate list of Appendix figures?
Update