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.
\documentclass{mwrep}
\begin{document}
\tableofcontents
\chapter{Blabla}
Aaaa
\chapter{Lablab}
Silly equation \ref{eq:silly} in appendix \ref{ap:1}.
\appendix
\chapter{Something more}\label{ap:1}
\begin{equation}\label{eq:silly}
2+2=5
\end{equation}
\end{document}

I got:

Contents
1. Blabla
2. Lablab
A. Something more

I need:

Contents
1. Blabla
2. Lablab
Appendix A. Something more

How can make every appendix in form: "Appendix A", "Appending B" etc?

EDIT:

I need a change at ToC and in the document (header of chapter).

How can I change a name of 'Appendix' if I want to use other word?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Load the appendix package with its titletoc option and use the appendices environment to enclose your appendices; this will add "Appendix" to the entries in the ToC. To Add "Appendix" to the headings in the document, a redefinition of \FormatBlockHeading (the style used by mwrep.cls to typeset chapter headings) will be needed. The following example shows these modifications:

\documentclass{mwrep}
\usepackage[titletoc]{appendix}

\begin{document}
\tableofcontents

\chapter{Blabla}
Aaaa

\chapter{Lablab}
Silly equation \ref{eq:silly} in appendix \ref{ap:1}.

\begin{appendices}
\makeatletter
\renewcommand*\FormatBlockHeading[1]{%
  \leftskip\@titleindent
  #1{\noindent
  \ifHeadingNumbered
    \@chapapp\ \mw@seccntformat\HeadingNumber
  \fi
  \ignorespaces\HeadingText\@@par}
  }
\makeatother
\chapter{Something more}\label{ap:1}
\begin{equation}\label{eq:silly}
2+2=5
\end{equation}
\end{appendices}

\end{document}

An image of the resulting ToC:

enter image description here

and an image of the first page of the appendix:

enter image description here

To change the word "Appenidix", if you are not loading babel, you can say

\renewcommand\appendixname{New Name}

in the preamble; if you are loading babel, you'll need

\AtBeginDocument{\renewcommand\appendixname{New Name}}
share|improve this answer
    
Edited my original question. –  Ichibann Aug 15 '12 at 16:07
    
@Ichibann I've updated my answer providing solutions to the new requirements. –  Gonzalo Medina Aug 15 '12 at 17:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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