<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to HowTo_AppendixToC</title><link>https://sourceforge.net/p/koma-script/wiki-en/HowTo_AppendixToC/</link><description>Recent changes to HowTo_AppendixToC</description><atom:link href="https://sourceforge.net/p/koma-script/wiki-en/HowTo_AppendixToC/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 01 Jul 2026 09:05:01 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/koma-script/wiki-en/HowTo_AppendixToC/feed" rel="self" type="application/rss+xml"/><item><title>HowTo_AppendixToC modified by Markus Kohm</title><link>https://sourceforge.net/p/koma-script/wiki-en/HowTo_AppendixToC/</link><description>&lt;div class="markdown_content"&gt;&lt;h1 id="h-how-to-add-your-own-directories-to-the-appendix"&gt;How to add your own directories to the appendix&lt;/h1&gt;
&lt;p&gt;The basic procedure for splitting a directory was already presented in “&lt;a href="/p/koma-script/wiki-en/HowTo_PartToC/"&gt;How to create a custom table of contents for parts (\part)&lt;/a&gt;.” For a complete solution with a separate table of contents, a separate list of figures, and a separate list of tables at the beginning of the appendix, you can expand on this solution and modify it slightly.&lt;/p&gt;
&lt;p&gt;As mentioned in the post above, since KOMA-Script v3.23, the auxiliary file used for the table of contents is specified via the &lt;code&gt;\ext@toc&lt;/code&gt; macro. For the list of figures, this has always been defined via &lt;code&gt;\ext@figure&lt;/code&gt;, and for the list of tables via &lt;code&gt;\ext@table&lt;/code&gt;. These macros can also be redefined within the document.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;tocbasic&lt;/code&gt; package, which is used by all KOMA-Script classes, also offers the option to define new tables of contents resp. list of floats using &lt;code&gt;\DeclareNewTOC&lt;/code&gt;. By default, these have the owner or category set to &lt;code&gt;float&lt;/code&gt;. This setting is also used for the list of figures and the list of tables. For the lists of floating environments in the appendix, you can simply retain this setting:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;\DeclareNewTOC&lt;/span&gt;[&lt;span class="c"&gt;%&lt;/span&gt;
  name=&lt;span class="k"&gt;\listoflofentryname&lt;/span&gt;,
  listname=&lt;span class="nb"&gt;{&lt;/span&gt;Figures in the Appendix&lt;span class="nb"&gt;}&lt;/span&gt;,&lt;span class="c"&gt;% Title of the list&lt;/span&gt;
]&lt;span class="nb"&gt;{&lt;/span&gt;alof&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;% File extension (a=appendix, lof=list of figures)&lt;/span&gt;
&lt;span class="k"&gt;\DeclareNewTOC&lt;/span&gt;[&lt;span class="c"&gt;%&lt;/span&gt;
  name=&lt;span class="k"&gt;\listoflotentryname&lt;/span&gt;,
  listname=&lt;span class="nb"&gt;{&lt;/span&gt;Tables in the Appendix&lt;span class="nb"&gt;}&lt;/span&gt;,&lt;span class="c"&gt;% Title of the list&lt;/span&gt;
]&lt;span class="nb"&gt;{&lt;/span&gt;alot&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;% File extension (a=appendix, lot=list of tables)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Incidentally, the &lt;code&gt;name&lt;/code&gt; option setting only has an effect if the class option &lt;code&gt;listof=entryprefix&lt;/code&gt; is used, which I strongly advise against for typographical reasons alone.&lt;/p&gt;
&lt;p&gt;For the new table of contents, however, a different owner should be selected. The standard table of contents generated by &lt;code&gt;\tableofcontents&lt;/code&gt; uses the owner &lt;code&gt;ToC&lt;/code&gt;. Therefore, we’ll use that here as well:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;\DeclareNewTOC&lt;/span&gt;[&lt;span class="c"&gt;%&lt;/span&gt;
  owner=ToC,&lt;span class="c"&gt;% Same setting as for \tableofcontents&lt;/span&gt;
  listname=&lt;span class="nb"&gt;{&lt;/span&gt;Appendix Contents&lt;span class="nb"&gt;}&lt;/span&gt;,&lt;span class="c"&gt;% Title of the table of contents&lt;/span&gt;
]&lt;span class="nb"&gt;{&lt;/span&gt;atoc&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;% File extension (a=appendix, toc=table of contents)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;If you’d rather not have the directories in the appendix respond to class options or other settings that depend on the owner or category, you can, of course, specify a separate category—for example, using &lt;code&gt;owner=appendix&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Incidentally, the file extensions in the examples above were chosen arbitrarily. The comments simply explain my reasoning behind them.&lt;/p&gt;
&lt;p&gt;Now these new directories can be used. To switch between them, it makes sense to include another command:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;\newcommand*&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\useappendixtocs&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\renewcommand*&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ext@toc&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;atoc&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\scr@ifundefinedorrelax&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;hypersetup&lt;span class="nb"&gt;}{}{&lt;/span&gt;&lt;span class="c"&gt;% so that it works even without hyperref&lt;/span&gt;
    &lt;span class="k"&gt;\hypersetup&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;bookmarkstype=atoc&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\renewcommand*&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ext@figure&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;alof&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\renewcommand*&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ext@table&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;alot&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The special feature here is &lt;code&gt;\hypersetup{bookmarkstype=atoc}&lt;/code&gt;. The &lt;code&gt;hyperref&lt;/code&gt; package—or rather, its recommended extension &lt;code&gt;bookmark&lt;/code&gt;, which is loaded by the KOMA-Script classes anyway—normally uses the entries in the auxiliary file with the &lt;code&gt;toc&lt;/code&gt; extension for bookmarks (aka outlines, aka PDF table of contents, aka everyone-calls-it-something-different). As soon as we switch to the &lt;code&gt;atoc&lt;/code&gt; extension, bookmarks are no longer generated for the entries in the appendix table of contents (links in the appendix table of contents still exist, of course). However, using the &lt;code&gt;bookmarkstype&lt;/code&gt; option, you can instruct &lt;code&gt;hyperref&lt;/code&gt; to use the entries in the auxiliary file with the specified extension for the bookmarks. So if you don’t want the entries in the appendix table of contents to appear in the bookmarks, simply delete these additional lines.&lt;/p&gt;
&lt;p&gt;It’s certainly also a good idea to provide a way back to the main table of contents. For example, you’d probably prefer to list a bibliography or an index in the main table of contents—if at all—rather than in the appendix.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;\newcommand*&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\usestandardtocs&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\renewcommand*&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ext@toc&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;toc&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\scr@ifundefinedorrelax&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;hypersetup&lt;span class="nb"&gt;}{}{&lt;/span&gt;&lt;span class="c"&gt;% so that it works even without hyperref&lt;/span&gt;
    &lt;span class="k"&gt;\hypersetup&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;bookmarkstype=toc&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\renewcommand*&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ext@figure&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;lof&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\renewcommand*&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ext@table&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;lot&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Here, too, in addition to simply changing the file extensions, the impact on &lt;code&gt;hyperref&lt;/code&gt; was also taken into account.&lt;/p&gt;
&lt;p&gt;I mentioned the &lt;code&gt;listof=entryprefix&lt;/code&gt; option earlier. This also enables the &lt;code&gt;listof=flat&lt;/code&gt; option for KOMA-Script classes. Unfortunately, via &lt;code&gt;\if@dynlist&lt;/code&gt;, this applies not only to the directories with owner &lt;code&gt;float&lt;/code&gt; resp. in the &lt;code&gt;float&lt;/code&gt; category, but to all directories. For the table of contents, &lt;code&gt;\if@tocleft&lt;/code&gt; is then explicitly used instead. As a result, with the previous code, &lt;code&gt;listof=flat&lt;/code&gt; is also used for &lt;code&gt;atoc&lt;/code&gt;. However, this can be easily fixed:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;\AfterTOCHead&lt;/span&gt;&lt;span class="na"&gt;[atoc]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\let\if@dynlist\if@tocleft&lt;/span&gt;
&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Here, the setting for the main table of contents is now also applied to &lt;code&gt;atoc&lt;/code&gt;, i.e., the table of contents for the appendix. Of course, you can also use &lt;code&gt;\@dynlistfalse&lt;/code&gt; or &lt;code&gt;\@dynlisttrue&lt;/code&gt; instead to explicitly disable or enable the flat display.&lt;/p&gt;
&lt;p&gt;So now you can already switch back and forth between the main tables of contents and the appendix tables of contents and output the new tables directly. The format in which the tables are output can be specified at any time using the &lt;code&gt;listof&lt;/code&gt; option (only for lists of floating environments)  or via &lt;code&gt;\setuptoc&lt;/code&gt; and &lt;code&gt;\unsettoc&lt;/code&gt;. For more details on the option and the two commands, refer to the KOMA-Script manual. At this point, it is also recommended that you review the KOMA-Script commands used above in the manual. They are easy to find using the index.&lt;/p&gt;
&lt;p&gt;Before I show a complete example using the code above, it’s worth noting that all of this works without the &lt;code&gt;appendixtoc&lt;/code&gt; package and, of course, without the &lt;code&gt;tocstyle&lt;/code&gt; package, which has never been officially supported. In principle, the use of other appendix packages may also affect the functionality of this solution. Of course, the solution also requires that you do not write directly into the auxiliary files using, for example, &lt;code&gt;\addcontentsline{toc}{…}&lt;/code&gt; or &lt;code&gt;\addcontentsline{lot}{…}&lt;/code&gt;. For floating environments, you should instead use, for example, &lt;code&gt;\addcontentsline{\ext@table}{…}&lt;/code&gt;. For entries in the table of contents, you can simply use the commands &lt;code&gt;\addparttocentry&lt;/code&gt;, &lt;code&gt;\addchaptertocentry&lt;/code&gt;, etc.—which are documented in the manual—instead of &lt;code&gt;\addcontentline{\ext@toc}{…}&lt;/code&gt; with the KOMA-Script classes.&lt;/p&gt;
&lt;p&gt;Here is a complete example:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;\documentclass&lt;/span&gt;&lt;span class="na"&gt;[listof=totoc,index=totoc]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;scrbook&lt;span class="nb"&gt;}&lt;/span&gt;[2021/04/30]
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;iftex&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\iftutex&lt;/span&gt;
  &lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;fontspec&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\else&lt;/span&gt;
  &lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[T1]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;fontenc&lt;span class="nb"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;lmodern&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\fi&lt;/span&gt;

&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;makeidx&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="k"&gt;\makeindex&lt;/span&gt;&lt;span class="c"&gt;% just as an example&lt;/span&gt;

&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;mwe&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;hyperref&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;% To demonstrate the implications/necessity of hyperref.&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;bookmark&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;% Because the hyperref has been significantly improved.&lt;/span&gt;


&lt;span class="k"&gt;\DeclareNewTOC&lt;/span&gt;[&lt;span class="c"&gt;%&lt;/span&gt;
  owner=ToC,&lt;span class="c"&gt;% same setting as for \tableofcontents&lt;/span&gt;
  listname=&lt;span class="nb"&gt;{&lt;/span&gt;Contents of the Appendix&lt;span class="nb"&gt;}&lt;/span&gt;,&lt;span class="c"&gt;% title of the directory&lt;/span&gt;
]&lt;span class="nb"&gt;{&lt;/span&gt;atoc&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;% file name extension (a=appendix, toc=table of contents)&lt;/span&gt;
&lt;span class="k"&gt;\DeclareNewTOC&lt;/span&gt;[&lt;span class="c"&gt;%&lt;/span&gt;
  name=&lt;span class="k"&gt;\listoflofentryname&lt;/span&gt;,&lt;span class="c"&gt;% irrelevant in this example&lt;/span&gt;
  listname=&lt;span class="nb"&gt;{&lt;/span&gt;Figures of the Appendix&lt;span class="nb"&gt;}&lt;/span&gt;,&lt;span class="c"&gt;% title of the directory&lt;/span&gt;
]&lt;span class="nb"&gt;{&lt;/span&gt;alof&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;% Dateierweiterung (a=appendix, lof=list of figures)&lt;/span&gt;
&lt;span class="k"&gt;\DeclareNewTOC&lt;/span&gt;[&lt;span class="c"&gt;%&lt;/span&gt;
  name=&lt;span class="k"&gt;\listoflotentryname&lt;/span&gt;,&lt;span class="c"&gt;% irrelevant in this example&lt;/span&gt;
  listname=&lt;span class="nb"&gt;{&lt;/span&gt;Tables of the Appendix&lt;span class="nb"&gt;}&lt;/span&gt;,&lt;span class="c"&gt;% title of the directory&lt;/span&gt;
]&lt;span class="nb"&gt;{&lt;/span&gt;alot&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;% Dateierweiterung (a=appendix, lot=list of tables)&lt;/span&gt;

&lt;span class="k"&gt;\makeatletter&lt;/span&gt;
&lt;span class="k"&gt;\newcommand*&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\useappendixtocs&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\renewcommand*&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ext@toc&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;atoc&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\scr@ifundefinedorrelax&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;hypersetup&lt;span class="nb"&gt;}{}{&lt;/span&gt;&lt;span class="c"&gt;% so that it works even without hyperref&lt;/span&gt;
    &lt;span class="k"&gt;\hypersetup&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;bookmarkstype=atoc&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\renewcommand*&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ext@figure&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;alof&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\renewcommand*&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ext@table&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;alot&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\newcommand*&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\usestandardtocs&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\renewcommand*&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ext@toc&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;toc&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\scr@ifundefinedorrelax&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;hypersetup&lt;span class="nb"&gt;}{}{&lt;/span&gt;&lt;span class="c"&gt;% so that it works even without hyperref&lt;/span&gt;
    &lt;span class="k"&gt;\hypersetup&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;bookmarkstype=toc&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\renewcommand*&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ext@figure&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;lof&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\renewcommand*&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ext@table&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;lot&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\AfterTOCHead&lt;/span&gt;&lt;span class="na"&gt;[atoc]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\let\if@dynlist\if@tocleft&lt;/span&gt;&lt;span class="c"&gt;% or \@dynlistfalse or \@dynlisttrue&lt;/span&gt;
&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\makeatother&lt;/span&gt;

&lt;span class="k"&gt;\AddToHook&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\KOMAClassName&lt;/span&gt;/appendix&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;% Make everything in \appendix automatic:&lt;/span&gt;
  &lt;span class="k"&gt;\addpart&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\appendixname&lt;/span&gt;&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;% - Entry in the main table of contents&lt;/span&gt;
  &lt;span class="k"&gt;\useappendixtocs&lt;/span&gt;&lt;span class="c"&gt;% - Switch to appendix directories&lt;/span&gt;
  &lt;span class="k"&gt;\listofatocs&lt;/span&gt;&lt;span class="c"&gt;% - Display the table of contents for the appendix&lt;/span&gt;
  &lt;span class="k"&gt;\listofalofs&lt;/span&gt;&lt;span class="c"&gt;% - Display a list of figures for the appendix&lt;/span&gt;
  &lt;span class="k"&gt;\listofalots&lt;/span&gt;&lt;span class="c"&gt;% - Display a list of tables for the appendix&lt;/span&gt;
&lt;span class="nb"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;\begin&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;document&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\tableofcontents&lt;/span&gt;
&lt;span class="k"&gt;\listoffigures&lt;/span&gt;
&lt;span class="k"&gt;\listoftables&lt;/span&gt;
&lt;span class="k"&gt;\blinddocument&lt;/span&gt;

&lt;span class="k"&gt;\begin&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;figure&lt;span class="nb"&gt;}&lt;/span&gt;[!h]
&lt;span class="k"&gt;\centering&lt;/span&gt;
&lt;span class="k"&gt;\rule&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;5cm&lt;span class="nb"&gt;}{&lt;/span&gt;2cm&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\caption&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;test-fig-main&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\end&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;figure&lt;span class="nb"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;\begin&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;table&lt;span class="nb"&gt;}&lt;/span&gt;[h]
&lt;span class="k"&gt;\caption&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;test-tab-main&lt;span class="k"&gt;\index&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;main&lt;span class="nb"&gt;}}&lt;/span&gt;
&lt;span class="k"&gt;\noindent&lt;/span&gt;
&lt;span class="k"&gt;\centering&lt;/span&gt;
&lt;span class="k"&gt;\begin&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;tabular&lt;span class="nb"&gt;}{&lt;/span&gt;|c|c|&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\hline&lt;/span&gt;
a &lt;span class="nb"&gt;&amp;amp;&lt;/span&gt; b&lt;span class="k"&gt;\tabularnewline&lt;/span&gt;
&lt;span class="k"&gt;\hline\hline&lt;/span&gt;
1 &lt;span class="nb"&gt;&amp;amp;&lt;/span&gt; 2&lt;span class="k"&gt;\tabularnewline&lt;/span&gt;
&lt;span class="k"&gt;\hline&lt;/span&gt;
&lt;span class="k"&gt;\end&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;tabular&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\end&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;table&lt;span class="nb"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;\appendix&lt;/span&gt;
&lt;span class="k"&gt;\blinddocument&lt;/span&gt;

&lt;span class="k"&gt;\begin&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;figure&lt;span class="nb"&gt;}&lt;/span&gt;[!h]
&lt;span class="k"&gt;\centering&lt;/span&gt;
&lt;span class="k"&gt;\rule&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;5cm&lt;span class="nb"&gt;}{&lt;/span&gt;2cm&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\caption&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;test-fig-appendix&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\end&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;figure&lt;span class="nb"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;\begin&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;table&lt;span class="nb"&gt;}&lt;/span&gt;[h]
&lt;span class="k"&gt;\caption&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;test-tab-appendix&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\noindent&lt;/span&gt;
&lt;span class="k"&gt;\centering&lt;/span&gt;
&lt;span class="k"&gt;\begin&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;tabular&lt;span class="nb"&gt;}{&lt;/span&gt;|c|c|&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\hline&lt;/span&gt;
a &lt;span class="nb"&gt;&amp;amp;&lt;/span&gt; b&lt;span class="k"&gt;\tabularnewline&lt;/span&gt;
&lt;span class="k"&gt;\hline\hline&lt;/span&gt;
1 &lt;span class="nb"&gt;&amp;amp;&lt;/span&gt; 2&lt;span class="k"&gt;\tabularnewline&lt;/span&gt;
&lt;span class="k"&gt;\hline&lt;/span&gt;
&lt;span class="k"&gt;\end&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;tabular&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\end&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;table&lt;span class="nb"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;\usestandardtocs&lt;/span&gt;
&lt;span class="k"&gt;\bookmarksetup&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;startatroot&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;% see the bookmark manual&lt;/span&gt;
&lt;span class="k"&gt;\printindex&lt;/span&gt;&lt;span class="c"&gt;% just as an example&lt;/span&gt;

&lt;span class="k"&gt;\end&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;document&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Incidentally, in the example, &lt;code&gt;makeidx&lt;/code&gt; was used intentionally rather than &lt;code&gt;imakeidx&lt;/code&gt;. For one thing, &lt;code&gt;imakeidx&lt;/code&gt; does not respond to the KOMA-Script option &lt;code&gt;index=totoc&lt;/code&gt;. Instead, you would have to use &lt;code&gt;\makeindex[intoc]&lt;/code&gt;. At the same time, &lt;code&gt;imakeidx&lt;/code&gt; always writes the table of contents entry using &lt;code&gt;\addcontentsline{toc}{…}&lt;/code&gt;. So the entry for the index would not end up in the appendix list anyway. Consequently, you wouldn’t need &lt;code&gt;\usestandardtocs&lt;/code&gt; either. However, I wanted to demonstrate the purpose of this command, which becomes clear if you try commenting it out in the example above and running two new LaTeX compiles. You don’t need to run MakeIndex again, though, if the index has already been generated for the unchanged example.&lt;/p&gt;
&lt;p&gt;Incidentally, for the standard classes, simply loading &lt;code&gt;tocbasic&lt;/code&gt; would not be sufficient to use the code above. For one thing, these classes always hard-code entries into the auxiliary file &lt;code&gt;toc&lt;/code&gt;. Furthermore, within &lt;code&gt;\@chapter&lt;/code&gt;, they hard-code entries into &lt;code&gt;lof&lt;/code&gt; and &lt;code&gt;lot&lt;/code&gt; instead of correctly using &lt;code&gt;\ext@figure&lt;/code&gt; and &lt;code&gt;\ext@table&lt;/code&gt; there. For these classes, it would therefore be necessary to patch &lt;code&gt;\addtocontents&lt;/code&gt;. This is, of course, possible and, in combination with certain packages, can even be useful when using a KOMA-Script class. Such a patch might look like this (untested):&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;\ExplSyntaxOn&lt;/span&gt;
&lt;span class="k"&gt;\NewCommandCopy&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\appendixtoc_saved_addtocontents:nn&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="k"&gt;\addtocontents&lt;/span&gt;&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\RenewDocumentCommand&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\addtocontents&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;m+m&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\exp_args:Ne&lt;/span&gt; &lt;span class="k"&gt;\appendixtoc_saved_addtocontents:nn&lt;/span&gt;
    &lt;span class="nb"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;\str_case:enF&lt;/span&gt; &lt;span class="nb"&gt;{&lt;/span&gt;#1&lt;span class="nb"&gt;}&lt;/span&gt;
        &lt;span class="nb"&gt;{&lt;/span&gt;
          &lt;span class="nb"&gt;{&lt;/span&gt;toc&lt;span class="nb"&gt;}&lt;/span&gt; &lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ext@toc&lt;/span&gt;&lt;span class="nb"&gt;}&lt;/span&gt;
          &lt;span class="nb"&gt;{&lt;/span&gt;lot&lt;span class="nb"&gt;}&lt;/span&gt; &lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ext@table&lt;/span&gt;&lt;span class="nb"&gt;}&lt;/span&gt;
          &lt;span class="nb"&gt;{&lt;/span&gt;lof&lt;span class="nb"&gt;}&lt;/span&gt; &lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ext@figure&lt;/span&gt;&lt;span class="nb"&gt;}&lt;/span&gt;
        &lt;span class="nb"&gt;}&lt;/span&gt; &lt;span class="nb"&gt;{&lt;/span&gt;#1&lt;span class="nb"&gt;}&lt;/span&gt;
    &lt;span class="nb"&gt;}&lt;/span&gt; &lt;span class="nb"&gt;{&lt;/span&gt;#2&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\ExplSyntaxOff&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Markus Kohm</dc:creator><pubDate>Wed, 01 Jul 2026 09:05:01 -0000</pubDate><guid>https://sourceforge.net2a4cbdf3da805e74d560859324d63a622994c9ff</guid></item></channel></rss>