ShortToc and Appendix

301 views
Skip to first unread message

Dyaus

unread,
Apr 20, 2011, 3:50:23 AM4/20/11
to LaTeX Users Group
Hello:

This is my first post here and I hope to learn from and contribute to
this group.

I am using the shorttoc package to produce a Short Table of Contents
and a regular Table of Contents. My short table of contents only
displays Chapters, while the Full Table of Contents displays Chapters,
Sections, and Subsections. Since Appendices are treated as chapters, I
want them to appear only in the full table of contents. Using
\chapter* after declaring \appendix doesn't help since the entries
disappear from both toc and shorttoc.

I am also using a modification of the UCLAthes class that makes it
difficult to change the Appendices to sections, which would remove
them from the shorttoc.

Any help will be greatly appreciated.

Peter Flynn

unread,
Apr 21, 2011, 4:12:24 AM4/21/11
to latexus...@googlegroups.com
On Wed, Apr 20, 2011 at 8:50 AM, Dyaus <aditya...@gmail.com> wrote:
Hello:

This is my first post here and I hope to learn from and contribute to
this group.

I am using the shorttoc package to produce a Short Table of Contents
and a regular Table of Contents. My short table of contents only
displays Chapters, while the Full Table of Contents displays Chapters,
Sections, and Subsections. Since Appendices are treated as chapters, I
want them to appear only in the full table of contents.

shorttoc was not designed to do that. It works with depth levels, not names (see the table at http://latex.silmaril.ie/formattinginformation/basics.html#sections)

An appendix is at the same level as a chapter, as you have seen, so it will get included.
 
Using
\chapter* after declaring \appendix doesn't help since the entries
disappear from both toc and shorttoc.

That's because the starred version of sectional commands does not record information in the ToC.

What you could do is use \chapter* but add the command
\addcontentsline{toc}{section}{the title of the appendix}
immediately afterwards. This will make an entry for the appendix in the ToC, but in the section style. This means it will not appear in the \shorttoc, but it will appear in the main ToC in the section style.

///Peter

Dyaus

unread,
Apr 22, 2011, 2:21:04 AM4/22/11
to LaTeX Users Group
Thanks Peter.

Your solution works well. Is there a way to print a table of contents
of just the appendix before the first appendix begins? (Preferably
without using the \begin{appendices} environment since that doesn't
work well with the UCLAthes documentclass.



On Apr 21, 1:12 am, Peter Flynn <anglebrac...@gmail.com> wrote:
> On Wed, Apr 20, 2011 at 8:50 AM, Dyaus <adityabin...@gmail.com> wrote:
> > Hello:
>
> > This is my first post here and I hope to learn from and contribute to
> > this group.
>
> > I am using the shorttoc package to produce a Short Table of Contents
> > and a regular Table of Contents. My short table of contents only
> > displays Chapters, while the Full Table of Contents displays Chapters,
> > Sections, and Subsections. Since Appendices are treated as chapters, I
> > want them to appear only in the full table of contents.
>
> shorttoc was not designed to do that. It works with *depth levels*, not
> names (see the table athttp://latex.silmaril.ie/formattinginformation/basics.html#sections)
>
> An appendix is at the same level as a chapter, as you have seen, so it will
> get included.
>
> > Using
> > \chapter* after declaring \appendix doesn't help since the entries
> > disappear from both toc and shorttoc.
>
> That's because the starred version of sectional commands does not record
> information in the ToC.
>
> What you could do is use \chapter* but add the command
> \addcontentsline{toc}{section}{*the title of the appendix*}

Peter Flynn

unread,
Apr 23, 2011, 6:07:16 PM4/23/11
to latexus...@googlegroups.com
On Fri, Apr 22, 2011 at 7:21 AM, Dyaus <aditya...@gmail.com> wrote:
Thanks Peter.

Your solution works well. Is there a way to print a table of contents
of just the appendix before the first appendix begins?

Probably :-)

I'm not sure what happens if you try to read the .toc file twice, once at the start and once at the beginning of the appendixes: by that time the .toc file has probably been half-overwritten with the new data for all the preceding chapters. You would have to find a way to disable temporarily (ie set to {}) all the entry macros for chapters, sections, etc, until it encountered a chapter ToC macro that referenced "A", at which point it would have to re-enable the macros.

Maybe look at how some of the many packages that deal with ToC work (eg minitoc).

///Peter

Reply all
Reply to author
Forward
0 new messages