Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Possible Duplicate:
How to make appendices behave like sections in ToC

Consider the minimal example below. How can I achieve that in the appendix part (only there!) of the ToC paragraphs are aligned with sections? Paragraphs should also figure as sections in the pdf bookmarks!

EDIT: Added hyperref.

\documentclass[10pt, a4paper]{report}

\usepackage[titletoc]{appendix}
\usepackage{hyperref}

\begin{document}

\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{4}   
\tableofcontents

\chapter{XXX}
\section{YYY}
\subsection{WER}
\subsubsection{ABC}
\subsubsection{DEF}
\subsection{ZTR}
\subsubsection{OIU}
\subsubsection{OIZ}
\subsubsection{POI}
\paragraph{tzu}
\paragraph{rfv}
\begin{appendices}
\makeatletter
\def\chaptermark#1{\markboth{\MakeUppercase{\@chapapp. \  #1}}{}}
\def\thechapter{}
\makeatother
\chapter{AAA}
\paragraph{abc}
\paragraph{def}
\paragraph{ghi}
\end{appendices}

\end{document}
share|improve this question

marked as duplicate by pluton, Gonzalo Medina, lockstep, Marco Daniel, percusse Jul 26 '12 at 22:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
see tex.stackexchange.com/questions/64403/… –  pluton Jul 25 '12 at 13:06
add comment

1 Answer 1

Here is a solution.

\documentclass[10pt, a4paper]{report}

\usepackage[titletoc]{appendix}
\usepackage{hyperref} 
\usepackage{bookmark}

\begin{document}

\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{4}   
\tableofcontents

\chapter{XXX}
\section{YYY}
\subsection{WER}
\subsubsection{ABC}
\subsubsection{DEF}
\subsection{ZTR}
\subsubsection{OIU}
\subsubsection{OIZ}
\subsubsection{POI}
\paragraph{tzu}
\paragraph{rfv}

\makeatletter
\addtocontents{toc}{\let\protect\l@paragraph\protect\l@section}
\makeatother

\begin{appendices}
\makeatletter
\def\chaptermark#1{\markboth{\MakeUppercase{\@chapapp. \  #1}}{}}
\def\thechapter{}
\makeatother
\chapter{AAA}
\paragraph{abc}
\paragraph{def}
\paragraph{ghi}
\end{appendices}

\end{document}   

Note that to ensure pdf bookmarks in the appendix also behave like sections it seems to be necessary to use the bookmark package (but don't ask me why).

share|improve this answer
    
This is not a correct solution; the ToC won't be as expected and you get warnings. –  Gonzalo Medina Jul 25 '12 at 13:47
    
@Gonzalo Medina: Where has your enhanced solution gone? Has it been deleted? If yes why??? –  lpdbw Jul 25 '12 at 16:53
    
I deleted my answer since it was not complete. –  Gonzalo Medina Jul 25 '12 at 16:54
    
@Gonzalo Medina: But you said that mine was suboptimal. If you are still of this opinion, I think your answer should be displayed since otherwise people coming acroos this thread might be mislead and use my suboptimal solution. And in how far was it not complete? –  lpdbw Jul 25 '12 at 16:59
    
You're right. If a have time I will review my answer and once it's complete I'll undelete it. –  Gonzalo Medina Jul 25 '12 at 17:01
show 1 more comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.