[Tex/LaTex] appendix package:toc and title options output not exactly expected

appendicestable of contents

I'm trying to use the subappendices environment from the appendix package (http://mirrors.ctan.org/macros/latex/contrib/appendix/appendix.pdf) in order to put appendices after each chapter or so (with side content related to the chapter and such).

The content layout and basic usage of the package work just fine, but I have issues with options, namely toc and page. My goal is to have appendices somewhat separated from the rest of the content both in the toc and in the main matter, which, to my understanding is achieved by calling those two options. Unfortunately, adding these options doesn't seem to change anything.

I'm running Kile on mint KDE and texlive (2012), and I install the texlive-latex-* packages from the command line package manager. Here's my code (I removed content but left all the other packages in case the problem would come from conflicts or w/e):

\documentclass[a4paper,11pt]{report}
\usepackage[english,frenchb]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

\usepackage{fixltx2e}

\usepackage{float}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{subcaption}

\usepackage[chapter]{algorithm}
\usepackage{algorithmic}
\algsetup{linenodelimiter=}
\renewcommand{\algorithmiccomment}[1]{\##1}

\usepackage{amsmath}

\usepackage{perpage}
\MakePerPage{footnote}

\bibliographystyle{alpha}

\usepackage[titletoc,title,toc,page]{appendix}

\usepackage{lipsum}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\title{title}
\author{me}

\begin{document}
  \selectlanguage{english}
\begin{abstract}
  \lipsum[1]
\end{abstract}

\selectlanguage{frenchb}
\begin{abstract}
  \lipsum[2] 
\end{abstract}

\tableofcontents

\chapter{Introduction}
\lipsum[1]
\section{Intérêt du projet}
\lipsum[2]

\begin{subappendices}
\section{Code de ceci}
\lipsum[3]
\section{Détails de cela}
\lipsum[4]
\end{subappendices}

\chapter{Next}
\lipsum[6]
\section{section}
\lipsum[5]

\end{document}

And here's what I get:

not putting a appendices header before listing appendices:

not putting an "appendices" header before listing appendices

not putting an "appendices" title/page before starting the appendices content:

not putting a appendices title/page before starting the appendices content

N.B. : Note that I'm using the exact same preamble as the first answer of Appendix in LaTeX which seems to succesfully output what was intended, unlike what I get.

Best Answer

As already stated by cfr: Only title and titletoc options are supported by the subappendices environment.

However, using the command \AtBeginEnvironment from etoolbox, it is possible to add some code to the beginning of the subappendices environment, i.e. adding vertial space to the ToC and shifting the per-chapter appendix to a new page, having a \chapter* like heading.

The detailed formatting of the per - chapter - appendix page is left to the O.P. or anybody that wants to change this as an exercise!

The fixltx2e package isn't necessary since April 2015, so I removed it from being included.

\documentclass[a4paper,11pt]{report}
\usepackage[english,frenchb]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

\usepackage{float}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{subcaption}

\usepackage[chapter]{algorithm}
\usepackage{algorithmic}
\algsetup{linenodelimiter=}
\renewcommand{\algorithmiccomment}[1]{\##1}

\usepackage{amsmath}

\usepackage{perpage}
\MakePerPage{footnote}

\bibliographystyle{alpha}

\usepackage[titletoc,title,toc,page]{appendix}


\usepackage{etoolbox}

\makeatletter
\AtBeginEnvironment{subappendices}{%
  \addtocontents{toc}{\protect\addvspace{10\p@}}
  \chapter*{\appendixname\ de \chaptername \thechapter}
}
\makeatother

\usepackage{lipsum}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\title{title}
\author{me}

\begin{document}
  \selectlanguage{english}
\begin{abstract}
  \lipsum[1]
\end{abstract}

\selectlanguage{frenchb}
\begin{abstract}
  \lipsum[2] 
\end{abstract}

\tableofcontents

\chapter{Introduction}
\lipsum[1]
\section{Intérêt du projet}
\lipsum[2]

\begin{subappendices}
\section{Code de ceci}
\lipsum[3]
\section{Détails de cela}
\lipsum[4]
\end{subappendices}

\chapter{Next}
\lipsum[6]
\section{section}
\lipsum[5]

\end{document}

enter image description here

Related Question