[Tex/LaTex] Changing heading of appendix

appendicesmwcls

\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?

Best Answer

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}}