8

I have the following document:

\documentclass[11pt,a4paper,twoside]{book}
 \usepackage[spanish,activeacute]{babel}
 \usepackage[titletoc]{appendix}

 \begin{document}

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

  \chapter{First chapter}

  \begin{appendices}
   \addappheadtotoc
   \appendixpage
   \clearpage
   \chapter{Some name}
   \label{label1}
   blah blah
  \end{appendices}

\end{document}

this gives in the ToC:

Apéndice Appendices....................60
Apéndice A. Some name..................63

and in the body of the document:

Appendices
(page skip)
Apéndice A
Some name

blah blah
  1. The TOC shows "Apéndice Appendices" and I need it to show "Apéndices" (note the "s" at the end of that word; it's not the same word that the first one currently in the TOC) Also in the body of the document it shows "Appendices" (in english) and I also need it to say "Apéndices" (in spanish), ie: the same word that should be displayed in the TOC. This looks like a babel issue to me.

  2. Is there a way not to have to give each appendix a name? This is done with the \chapter{Some name} command, but I'd like the name of Apéndice A to be just that: Apéndice A. This way the ToC would look like (assuming the 1st point is fixed):

    Apéndices........................60
    Apéndice A.......................63
    

    and the body of the document:

    Apéndices
    (page skip)
    Apéndice A
    
    blah blah
    

    Is there any way to do this?


I think a hack to accomplish the 2nd point would be to combine @murray's answer with not giving a name to the chapter. This is, this line \chapter{Some name} would have to be replaced by:

\chapter[]{}

It's not pretty but I think it gets the job done. If anybody knows of a more elegant way to do this, please let me know.

10
  • Please provide a bit more information about your document's setup: Which document class do you use, do you use the babel package (and, if so, which which language(s))?
    – Mico
    Jun 27, 2012 at 22:10
  • Done @Mico, tell me if there's anything else I should add.
    – Gabriel
    Jun 27, 2012 at 22:17
  • Done @Caramdir. It's very minimal, my actual set up is quite huge, but I think it's enough to give an idea.
    – Gabriel
    Jun 27, 2012 at 23:53
  • 1
    @Gaba_p: That's exactly how it should be. (I can't help you personally but I'm sure with that info added someone else will be able to help you.)
    – Caramdir
    Jun 27, 2012 at 23:57
  • 2
    @Gaba_p: No, I meant the MWE is exactly how it should be (i.e. very minimal).
    – Caramdir
    Jun 28, 2012 at 0:09

2 Answers 2

10

If I understand the appendix manual correctly, then the \addappheadtotoc and \appendixpage should only be used if the appendices environment is not used. If the appendices environment is used, then the same effect is created by using the toc and page package options, i.e. loading the package as

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

Further, since babel doesn't contain translations for the appendix package, you have to set them yourself:

\renewcommand{\appendixtocname}{Ap\'endices}
\renewcommand{\appendixpagename}{Ap\'endices}

The actual appendices are then created with (note that the \clearpage is not needed)

\begin{appendices}
  \chapter{Some name}
  blah blah
\end{appendices}

This gives me the desired result:

result

4
  • Your answer almost takes care of the 1st issue. The only problem is that I'm still getting "Appendices" in english instead of "Apéndices" in spanish, which is what I actually need.
    – Gabriel
    Jun 28, 2012 at 2:36
  • 1
    @Gaba_p: Sorry, I missed that. See the updated answer.
    – Caramdir
    Jun 28, 2012 at 2:50
  • Thank you @Caramdir, your solution worked great for the 1st point.
    – Gabriel
    Jun 28, 2012 at 12:55
  • Since I'll be moving the second part of this question onto its own question, I'll mark this as the answer for the 1st point.
    – Gabriel
    Jun 29, 2012 at 14:20
2

I think the following will do what you want: for each individual appendix, instead of \chapter{Some name} use \chapter[]{Some name}.

3
  • Your comment made me realize an error I had in the MWE. I've corrected it now: added \label{label1} below \chapter{Some name}. Now, I'm not sure what your answer is supposed to do, could you explain it a bit please?
    – Gabriel
    Jun 28, 2012 at 1:27
  • I think I see now: your answer makes the "Some name" disappear from the TOC, but unfortunately it still needs the \chapter{Some name} command and it still shows that name in the document body. It also doesn't fix the 1st issue. Thanks for your help!
    – Gabriel
    Jun 28, 2012 at 1:29
  • I used this answer in combination with an ugly hack to somehow fix the 2nd point. It's not a full answer so I can't mark it as such though. Regards.
    – Gabriel
    Jun 28, 2012 at 1:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .