3

I'm trying to use the subappendices environment from the appendix package (ftp://ftp.tex.ac.uk/pub/archive/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.

  • Isn't this the expected behaviour since you are using the subappendices environment? According to the documentation (p. 4), this environment only recognises the title and titletoc options so the use of the other options (toc and page) have no effect. – cfr Jan 4 '14 at 22:06
  • Oh yeah, right, sorry for this stupid mistake. Now what would you do in order to have each new appendix section begin on a new page? I'm thinking about a new \appsec{sectionTitle} command which would do \newpage and then \section{sectionTitle}, but it would be the first time I'd do that. Would that be appropriate? (Having thought about this, having an appendices header in the toc isn't that important) – nathdwek Jan 5 '14 at 11:41
  • Note for future readers: Package fixltx2e isn't necessary any longer since 2015 – user31729 Jan 29 '17 at 21:45
2

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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