
Gostaria de saber como mostrar as seções dos apêndices (B.1, B.2) em nível de subseção no TOC.
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}
Observe que estou usando o último trecho de código para mostrar os apêndices (A, B) no nível da seção no sumário.
Responder1
Proponho uma nova abordagem: em vez de alterar as entradas do ToC, agora é mais fácil alterar a formatação dos títulos das unidades seccionais nos apêndices; no exemplo a seguir usei otitlesec
pacote para definir um \changesections
comando que fará com que os títulos das seções se pareçam com os dos capítulos normais e, da mesma forma, os títulos das subseções se parecerão com os das seções normais:
\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}