[Tex/LaTex] Format appendix chapter title with titlesec in a scrbook

appendiceskoma-scriptsectioningtitlesec

I'm writing a longer text and redefined the Design of a Chapter start page using titlesec. For example

\documentclass[cleardoublepage=empty,fontsize=11pt,a4paper,twoside,DIV=calc]{scrbook}

\usepackage[no-math]{fontspec}
\usepackage{xunicode,xcolor} 
\usepackage{hyperref,titlesec,scalefnt}

\titleformat{\chapter}[display]%
    {\relax\huge\color{blue}}%
    {\Huge\raggedleft{\textcolor{blue!25}{\scalefont{4}\thechapter}}}{0pt}{}
\titlespacing{\chapter}{0pt}{\baselineskip}{\baselineskip}

\begin{document}
    \begin{mainmatter}
        \chapter{Eins}
    \end{mainmatter}
    \begin{backmatter}
        \chapter{Ein Beispiel}
    \end{backmatter}
\end{document}

Which sets the chapter number in light blue and huge to the right (see Chapter 1). But if i change into the backmatter to add an appendix chapter (which should be apendix A), the whole titlesec (from the second block) definition is lost.
I would like to have A as the “appendix number” and set to the right, as the chapter number before (and of course “A An Example” to the toc).

How can i achieve, that the numbering is set to A (and shown) and that the titlesec-definition is not lost?

Best Answer

\backmatter (which, BTW is -- like \frontmatter -- a switch, not an environment) will turn off sectioning numbering, including the numbering of appendices. Use \appendix instead of \backmatter.

\documentclass{scrbook}

\usepackage[no-math]{fontspec}
\usepackage{xunicode,xcolor} 
\usepackage{hyperref,titlesec,scalefnt}

\titleformat{\chapter}[display]%
    {\relax\huge\color{blue}}%
    {\Huge\raggedleft{\textcolor{blue!25}{\scalefont{4}\thechapter}}}{0pt}{}
\titlespacing{\chapter}{0pt}{\baselineskip}{\baselineskip}

\begin{document}

\mainmatter
\chapter{Eins}

\appendix
\chapter{Ein Beispiel}

\end{document}