<?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_TocAppendixPrefix</title><link>https://sourceforge.net/p/koma-script/wiki-en/HowTo_TocAppendixPrefix/</link><description>Recent changes to HowTo_TocAppendixPrefix</description><atom:link href="https://sourceforge.net/p/koma-script/wiki-en/HowTo_TocAppendixPrefix/feed" rel="self"/><language>en</language><lastBuildDate>Thu, 05 Jun 2025 08:33:28 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/koma-script/wiki-en/HowTo_TocAppendixPrefix/feed" rel="self" type="application/rss+xml"/><item><title>HowTo_TocAppendixPrefix modified by Markus Kohm</title><link>https://sourceforge.net/p/koma-script/wiki-en/HowTo_TocAppendixPrefix/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -1,4 +1,4 @@
-# How to prepend an “appendix” to the number of chapter entries of the appendix in the table of contents
+# How to prepend an “Appendix” to the number of chapter entries of the appendix in the table of contents

 In “[How to prepend a 'chapter' to the number of chapter entries in the table of contents](wiki-en:HowTo_TocChapterPrefix)” both normal chapters and appendix chapters are prefixed in the table of contents. Sometimes, however, this is only requested for the appendix. So this is similar to the usage of option `appendixprefix=true` for the headings in the text.

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Markus Kohm</dc:creator><pubDate>Thu, 05 Jun 2025 08:33:28 -0000</pubDate><guid>https://sourceforge.netc60575e75006efb1de531d6a9f55c262f96dbf04</guid></item><item><title>HowTo_TocAppendixPrefix modified by Markus Kohm</title><link>https://sourceforge.net/p/koma-script/wiki-en/HowTo_TocAppendixPrefix/</link><description>&lt;div class="markdown_content"&gt;&lt;h1 id="how-to-prepend-an-appendix-to-the-number-of-chapter-entries-of-the-appendix-in-the-table-of-contents"&gt;How to prepend an “appendix” to the number of chapter entries of the appendix in the table of contents&lt;/h1&gt;
&lt;p&gt;In “&lt;a class="" href="/p/koma-script/wiki-en/HowTo_TocChapterPrefix/"&gt;How to prepend a 'chapter' to the number of chapter entries in the table of contents&lt;/a&gt;” both normal chapters and appendix chapters are prefixed in the table of contents. Sometimes, however, this is only requested for the appendix. So this is similar to the usage of option &lt;code&gt;appendixprefix=true&lt;/code&gt; for the headings in the text.&lt;/p&gt;
&lt;p&gt;Anyway, this works in the same way as already shown in the post linked above. However, we need to distinguish between entries in the appendix and entries outside the appendix. We make this distinction via a suitable definition of &lt;code&gt;\appendixmore&lt;/code&gt;:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&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;\tocchapapp&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;\appendixmore&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;\tocchapapp&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="k"&gt;\chapapp\ &lt;/span&gt;&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&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;\csname&lt;/span&gt; ext@toc&lt;span class="k"&gt;\endcsname&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
    &lt;span class="k"&gt;\string\DeclareTOCStyleEntry&lt;/span&gt;&lt;span class="na"&gt;[numwidth+=5em]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;chapter&lt;span class="nb"&gt;}{&lt;/span&gt;chapter&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="nb"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;So here by calling &lt;code&gt;\appendix&lt;/code&gt; firstly the command &lt;code&gt;\tocchapapp&lt;/code&gt; is suitably redefined, namely with prefix plus following space. Secondly, a change of width for numbering is written into the current table of contents file defined by &lt;code&gt;\ext@toc&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;What is then missing is the replacement of &lt;code&gt;\chapapp\&lt;/code&gt; with the new &lt;code&gt;\tocchapapp&lt;/code&gt;. This changes the first example to:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;\documentclass&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;scrbook&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;blindtext&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;\tocchapapp&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;\appendixmore&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;\tocchapapp&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="k"&gt;\chapapp\ &lt;/span&gt;&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&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;\csname&lt;/span&gt; ext@toc&lt;span class="k"&gt;\endcsname&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
    &lt;span class="k"&gt;\string\DeclareTOCStyleEntry&lt;/span&gt;&lt;span class="na"&gt;[numwidth+=5em]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;chapter&lt;span class="nb"&gt;}{&lt;/span&gt;chapter&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="nb"&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;\addchaptertocentry&lt;/span&gt;&lt;span class="nb"&gt;}&lt;/span&gt;[2]&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\IfArgIsEmpty&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;#1&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;% keine Nummer:&lt;/span&gt;
    &lt;span class="k"&gt;\addtocentrydefault&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;chapter&lt;span class="nb"&gt;}{&lt;/span&gt;#1&lt;span class="nb"&gt;}{&lt;/span&gt;#2&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="c"&gt;% wie bisher&lt;/span&gt;
  &lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;% mit Nummer:&lt;/span&gt;
    &lt;span class="k"&gt;\addtocentrydefault&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;chapter&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="k"&gt;\tocchapapp&lt;/span&gt;#1&lt;span class="nb"&gt;}{&lt;/span&gt;#2&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="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;\blinddocument&lt;/span&gt;
&lt;span class="k"&gt;\addchap&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;Heading of not numbered chapter&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\blindtext&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;\addchap&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;Heading of not numbered appendix&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\blindtext&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;/pre&gt;&lt;/div&gt;


&lt;p&gt;In the second example, where unnumbered entries are to be prefixed as well, the whole thing actually makes no sense. Nevertheless, I want to show the appropriate code here:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;\documentclass&lt;/span&gt;&lt;span class="na"&gt;[toc=numberline]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;scrbook&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;blindtext&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;\tocchapapp&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;\appendixmore&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="c"&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;\csname&lt;/span&gt; ext@toc&lt;span class="k"&gt;\endcsname&lt;/span&gt;&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
    &lt;span class="k"&gt;\string\DeclareTOCStyleEntry&lt;/span&gt;[numwidth+=5em,
      entrynumberformat=&lt;span class="k"&gt;\string\appendixprefixformat&lt;/span&gt;]&lt;span class="nb"&gt;{&lt;/span&gt;chapter&lt;span class="nb"&gt;}{&lt;/span&gt;chapter&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="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;\appendixprefixformat&lt;/span&gt;&lt;span class="nb"&gt;}&lt;/span&gt;[1]&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\appendixname\ &lt;/span&gt;#1&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;\blinddocument&lt;/span&gt;
&lt;span class="k"&gt;\addchap&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;Heading of not numbered chapter&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\blindtext&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;\addchap&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;Heading of not numbered appendix&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\blindtext&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;/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>Tue, 03 Aug 2021 09:15:07 -0000</pubDate><guid>https://sourceforge.net393dda3cebe8919ecc230bbc883b860b10b74b9e</guid></item></channel></rss>