2

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}
3
  • Could you please see this: tex.stackexchange.com/questions/9138/…
    – kan
    May 12, 2013 at 7:08
  • It's not worked.My document class is report and i need to add appendix to table of contents as well as separate list.Can u please check my code and give me a simple solution for this matter..thank u
    – Emalka
    May 12, 2013 at 7:41
  • There is no \listofappendices. Do you need the package tocloft? May 12, 2013 at 9:22

1 Answer 1

2

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}
11
  • I cannot install the package{xpatch}. I try to search in MikTex package manager(Admin).There is no any package like xpatch.What is a solution for that?
    – Emalka
    May 12, 2013 at 10:46
  • @Emalka: Which version of MikTeX do you have? May 12, 2013 at 10:53
  • version 2.8.3761
    – Emalka
    May 12, 2013 at 10:55
  • @Emalka: As far as I know the current version of MikTeX is 2.9. Maybe you need this version. I am working with TeX Live and the package is part of this. However CTAN tells us that xpatch is part of MikTeX: ctan.org/pkg/xpatch May 12, 2013 at 10:58
  • 1
    @Emalka According to miktex.org/releases v2.9 is the current version since October 2010 so your version seems to be quite outdated
    – cgnieder
    May 12, 2013 at 11:52

You must log in to answer this question.

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