2

I have the following document. I'd like Appendix titles to be marked with the word 'Appendix', which the following achieves:

\documentclass[
chapterprefix=false,
appendixprefix=true, % Appendix 
numbers=noenddot
]{scrreprt}

\begin{document}
\chapter{One}
\appendix
\chapter{AAA}
XX
\end{document}

But I'd like the titles to be on the same line as 'Appendix A' etc. I know how to achieve this for the whole document's chapter titles:

\makeatletter
\renewcommand*{\chapterformat}{%
  \mbox{\chapapp~\thechapter\autodot:\enskip}%
}
\makeatother

But this overrides chapterprefix=false. How can I have this \chapterformat only apply to the appendix?

3
  • Try the appendix package which provides a lot of options and see this answer: tex.stackexchange.com/a/242010/89098
    – Ross
    Nov 26, 2016 at 3:13
  • Of course, you can move your redefinition of \chapterformat to just after \appendix, making it only apply from that point onward.
    – Werner
    Nov 26, 2016 at 3:16
  • @Werner that has no effect.
    – Hugh
    Nov 26, 2016 at 3:18

1 Answer 1

3

One possibility is (re-)defining \appendixmore:

\documentclass[
    numbers=noenddot,
]{scrreprt}

\providecommand*\appendixmore{}
\renewcommand*\appendixmore{%
    \renewcommand*{\chapterformat}{%
      \mbox{\appendixname~\thechapter\autodot:\enskip}%
    }%
}

\begin{document}
\chapter{One}
\appendix
\chapter{AAA}
XX
\end{document}

enter image description here

Note that option appendixprefix defines and uses \appendixmore too. So the redefinition of \appendixmore disables option appendixprefix=true.

Another possiblity is patching \appendix:

\documentclass[
    numbers=noenddot
]{scrreprt}

\usepackage{xpatch}
\xapptocmd{\appendix}{%
    \renewcommand*{\chapterformat}{%
      \mbox{\appendixname~\thechapter\autodot:\enskip}%
    }%
}{}{\PatchFailed}

\begin{document}
\chapter{One}
\appendix
\chapter{AAA}
XX
\end{document}

The result is the same as above.

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.