[Tex/LaTex] Separate List of Appendices in new page

appendicestable of contents

I need to get a separate List of Appendices in a new page, but I get an error

Undefined control sequence

My code is

\documentclass[12pt,a4paper,oneside]{report}
\usepackage[titletoc]{appendix}
\usepackage{tocloft}
\begin{document}

\addcontentsline{toc}{chapter}{TABLE OF CONTENTS}
\tableofcontents
\newpage

\listofappendices

\newpage

\chapter{a1}
aaaaaaaaaaaaaaaaaa
\chapter{b1}
bbbbbbbbbbbbbbbbbbbb

\addcontentsline{toc}{chapter}{APPENDICES}
\begin{appendices}
\chapter{MY}
ccccccccccccccccccccccccccc
\chapter{DFG}
dddddddddddddddd
\end{appendices}

\end{document}

Best Answer

There is no environment appendices. There is a command appendix which introduce the appendix.

To get a list of appendix you need a new auxiliary file. In the example below the new auxiliary file gets the extension toa (t able o f a ppendix). In the next step you must declare that all entries of the appendix are written to the new file. Therefor I am using the package xpatch:

\listfiles
\documentclass[12pt,a4paper,oneside]{report}
\usepackage[titletoc]{appendix}
\usepackage{tocloft}
\usepackage{xpatch}
\makeatletter
\newcommand\listofappendixname{Table of \appendixname}

\newcommand\listofappendices{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\listofappendixname
        \@mkboth{%
           \MakeUppercase\listofappendixname}{\MakeUppercase\listofappendixname}}%
    \@starttoc{toa}%
    \if@restonecol\twocolumn\fi
    }
\g@addto@macro\appendix{%
  \addcontentsline{toc}{chapter}{\appendixname}%
  \xpatchcmd{\@part}{\addcontentsline{toc}}{\addcontentsline{toa}}{}{}%
  \xpatchcmd{\@part}{\addcontentsline{toc}}{\addcontentsline{toa}}{}{}%
  \xpatchcmd{\@chapter}{\addcontentsline{toc}}{\addcontentsline{toa}}{}{}%
  \xpatchcmd{\@chapter}{\addcontentsline{toc}}{\addcontentsline{toa}}{}{}%
  \xpatchcmd{\@sect}{\addcontentsline{toc}}{\addcontentsline{toa}}{}{}%
  \xpatchcmd{\@sect}{\addcontentsline{toc}}{\addcontentsline{toa}}{}{}%
}
\makeatother
\begin{document}


\tableofcontents


\listofappendices

\newpage

\chapter{a1}
aaaaaaaaaaaaaaaaaa
\chapter{b1}
bbbbbbbbbbbbbbbbbbbb


\appendix

\chapter{MY}
ccccccccccccccccccccccccccc
\chapter{DFG}
dddddddddddddddd


\end{document}