Anhänge auf Unterabschnittsebene im Inhaltsverzeichnis

Anhänge auf Unterabschnittsebene im Inhaltsverzeichnis

Ich möchte wissen, wie die Abschnitte der Anhänge (B.1, B.2) im Inhaltsverzeichnis auf Unterabschnittsebene angezeigt werden.

MWE:

    % % % % % % % % % % % % Packages % % % % % % % % % % % % % % %
    \documentclass[11pt,a4paper]{report}
    \usepackage[english]{babel}     % english language
    \usepackage[latin1]{inputenc}   % accents in source
    \usepackage[T1]{fontenc}        % accents in DVI
    \usepackage{vmargin}            % redefine the margins
    \setmarginsrb{2.5cm}{1.5cm}{2.5cm}{1cm}{0cm}{0cm}{0cm}{1cm}

    \usepackage{appendix}

    \usepackage[
    hyperindex=true, % add links in the index
    bookmarks=true,  % show bookmarks bar when displaying the document}{hyperref}
    ]{hyperref}
    \hypersetup{
    colorlinks=true, % colored links
    breaklinks=true, % allows return line in too long links
    urlcolor= blue,  % links color
    linkcolor= blue, % internal links color
    citecolor= blue, % green by defaut, color of citation links (bibliography)
    bookmarksopen=true,
    }

    % code to show appendices' chapters at section level on TOC
    \makeatletter
    \newcommand\chapassect{%
    \def\@chapter[##1]##2{\ifnum \c@secnumdepth >\m@ne
                     \refstepcounter{chapter}%
                     \typeout{\@chapapp\space\thechapter.}%
                     \addcontentsline{toc}{section}%
                               {\protect\numberline{\thechapter}##1}%
                \else
                  \addcontentsline{toc}{section}{##1}%
                \fi
                \chaptermark{##1}%
                \addtocontents{lof}{\protect\addvspace{10\p@}}%
                \addtocontents{lot}{\protect\addvspace{10\p@}}%
                \if@twocolumn
                  \@topnewpage[\@makechapterhead{##2}]%
                \else
                  \@makechapterhead{##2}%
                  \@afterheading
                \fi}%
    }
    \makeatother


    % % % % % % % % % % RAPPORT % % % % % % % % % % % % % 

    \renewcommand\setthesection{\Alph{section}}

    \begin{document}
        % table of contents 
        \tableofcontents
        \newpage
        % end table of contents

        % chapter 1:
        \chapter{Introduction}
            \section{Problem overview}
            \section{Application description}
            \section{Work Goals}
        \newpage
        % end chapter 1 

        % appendices
        \appendix
        \clearpage % or \cleardoublepage
        \appendixpage
        \addappheadtotoc
        % code to show appendices at section level in TOC
        \chapassect
        \begin{appendices}
            \chapter{Installation requirements}    
        \chapter{Performance evaluation I appendix}     
            \section{Strahov}   
            \section{University laboratory}

        \end{appendices}
        % end appendices

    \end{document}

Ergebnis Inhaltsverzeichnis

Beachten Sie, dass ich den letzten Codeabschnitt verwende, um Anhänge (A, B) auf Abschnittsebene im Inhaltsverzeichnis anzuzeigen.

Antwort1

Ich schlage Ihnen einen neuen Ansatz vor: Anstatt die Inhaltsverzeichniseinträge zu ändern, ist es jetzt einfacher, die Titelformatierung für die Abschnittseinheiten in den Anhängen zu ändern. Im folgenden Beispiel habe ich dietitlesecPaket zum Definieren eines \changesectionsBefehls, der Abschnittstitel wie die von normalen Kapiteln aussehen lässt, und entsprechend werden Unterabschnittstitel wie die von normalen Abschnitten aussehen:

\documentclass[11pt,a4paper]{report}
\usepackage{appendix}
\usepackage{titlesec}
\usepackage{chngcntr}
\usepackage[
    hyperindex=true, % add links in the index
    bookmarks=true,  % show bookmarks bar when displaying the document}{hyperref}
    ]{hyperref}
    \hypersetup{
    colorlinks=true, % colored links
    breaklinks=true, % allows return line in too long links
    urlcolor= blue,  % links color
    linkcolor= blue, % internal links color
    citecolor= blue, % green by defaut, color of citation links (bibliography)
    bookmarksopen=true,
    }

% code to make appendices' sections look like chapters and subsections like sections
% in the body of the document
\makeatletter
\newcommand\changesections{%
\renewcommand\thesection{\Alph{section}}
\counterwithin{figure}{section}
\counterwithin{table}{section}
\renewcommand\thefigure{\thesection.\arabic{figure}}
\titleclass{\section}{top}
\newcommand\sectionbreak{\cleardoublepage}
\titleformat{\section}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thesection}{20pt}{\Huge}
\titlespacing*{\section}
  {0pt}{50pt}{40pt}
\titleformat{\subsection}
  {\normalfont\Large\bfseries}{\thesubsection}{1em}{}
\titlespacing*{\subsection}
  {0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
}
\makeatother

\begin{document}
% table of contents 
\tableofcontents
\newpage
% end table of contents

% chapter 1:
\chapter{Introduction}
\section{Problem overview}
\begin{figure}
\caption{test}
\end{figure} 
\section{Application description}
\begin{figure}
\caption{test}
\end{figure} 
\section{Work Goals}
\newpage
% end chapter 1 

% appendices
\appendix
\clearpage % or \cleardoublepage
\appendixpage
\addappheadtotoc

\begin{appendices}
\changesections% change formatting for the sectional units
\section{Installation requirements}
\begin{figure}
\caption{test}
\end{figure} 
\section{Performance evaluation I appendix}     
\begin{figure}
\caption{test}
\end{figure} 
\subsection{Strahov}
\subsection{University laboratory}
\end{appendices}
% end appendices

\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen