Seite 1 von 1

Seitenzahl im Anhangsverzeichnis ragt über den Seiterand

Verfasst: Do 6. Aug 2015, 11:42
von Holla
Hallo Leute,
\documentclass[
,a4paper
,fontsize=12pt
]{scrartcl}

\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc}  


%%% Anhangsverzeichnis
\makeatletter% --> De-TeX-FAQ
\newcommand*{\maintoc}{% Hauptinhaltsverzeichnis
  \begingroup
    \@fileswfalse% kein neues Verzeichnis öffnen
    \renewcommand*{\appendixattoc}{% Trennanweisung im Inhaltsverzeichnis
      \value{tocdepth}=-10000 % lokal tocdepth auf sehr kleinen Wert setzen
    }%
    \tableofcontents% Verzeichnis ausgeben
  \endgroup
}
\newcommand*{\appendixtoc}{% Anhangsinhaltsverzeichnis
  \begingroup
    \edef\@alltocdepth{\the\value{tocdepth}}% tocdepth merken
    \setcounter{tocdepth}{-10000}% Keine Verzeichniseinträge
    \renewcommand*{\contentsname}{% Verzeichnisname ändern
      Anhangsverzeichnis}%
    \renewcommand*{\appendixattoc}{% Trennanweisung im Inhaltsverzeichnis
      \setcounter{tocdepth}{\@alltocdepth}% tocdepth wiederherstellen
    }%
    \tableofcontents% Verzeichnis ausgeben
    \setcounter{tocdepth}{\@alltocdepth}% tocdepth wiederherstellen
  \endgroup
}
\newcommand*{\appendixattoc}{% Trennanweisung im Inhaltsverzeichnis
}
\g@addto@macro\appendix{% \appendix erweitern
  \cleardoublepage% Neue Seite
  \addcontentsline{toc}{section}{\appendixname}% Eintrag ins Hauptverzeichnis
  \addtocontents{toc}{\protect\appendixattoc}% Trennanweisung in die toc-Datei
}
\makeatother    



\begin{document}

\maintoc

\newpage\section{section}\subsection{subsection}\subsection{subsection}\subsection{subsection}\subsection{subsection}\section{section}\subsection{subsection}\subsection{subsection}\subsection{subsection}\subsection{subsection}\section{section}\subsection{subsection}\subsection{subsection}\subsection{subsection}\subsection{subsection}



\newpage\pagenumbering{Roman}\setcounter{page}{26}\appendix\appendixtoc

\newpage\section{Anhangsection}\subsection{Anhangsubsection}\subsection{Anhangsubsection}\subsection{Anhangsubsection}\section{Anhangsection}\subsection{Anhangsubsection}\subsection{Anhangsubsection}\subsection{Anhangsubsection}

\end{document}
Ich soll ein Anhangsverzeichnis machen. Habe den Codeschnippel irgendwo im Netz gefunden. Doch leider ragen die Seitenzahlen der Subsection aus dem Seitenrand.

Was läuft hier falsch und wie kann ich es ändern?

Gruß
Holla, die Waldfee

Verfasst: Do 6. Aug 2015, 12:40
von u_fischer
\newcommand*{\appendixtoc}{% Anhangsinhaltsverzeichnis
  \begingroup
    \renewcommand\@pnumwidth{7ex}%<---- Mehr Platz für Zahlen.
 ..........

Verfasst: Do 6. Aug 2015, 12:49
von Holla
Genial, Ulrike, du bist spitze.
Tausendfacher Dank


Gruß
Holla, die Waldfee