4

I researched, and I am having a similar trouble to this one: Reset section numbering between unnumbered chapters

My problem is the following. I am using koma-script book class. I want to use \chapter* for Appendices, so that it doesn't say Chapter 7 after having six chapters. In particular, after the end of Chapter 6, I have the following.

\newpage
\phantomsection
\addcontentsline{toc}{chapter}{Appendices}
\chapter*{Appendices}
\setcounter{section}{0}
\renewcommand{\thesection}{\Alph{section}}
\section{Title of appendix A}
\section{Title of appendix B}
\section{Title of appendix C}

Now, the above code allows me to put A, B, C for each appendix, but hyperref bookmarks are messed up (same as the issue of the link). So instead of

\renewcommand{\thesection}{\Alph{section}}

I tried with

\renewcommand{\theHsection}{\Alph{section}}

This fixes hyperref links, but it puts 6.1, 6.2, 6.3 instead of A, B, C for each of my appendix. How can I use the alphabet instead of numbers together with \theHsection?

Edited:

Please look at the following code:

\documentclass[paper=letter, fontsize=11pt, chapterprefix=on, oneside]{scrbook}
\usepackage{hyperref}
\renewcommand{\thesection}{\thechapter.\arabic{section}}

\begin{document}
\tableofcontents

\chapter{First numbered chapter}
\section{AB}
\section{BC}
\section{DE}

\newpage
\phantomsection
\addcontentsline{toc}{chapter}{Appendices}
\chapter*{Appendices}
\setcounter{section}{0}
\renewcommand{\thesection}{\Alph{section}}
\section{Title of appendix A}
\section{Title of appendix B}
\section{Title of appendix C}
\end{document}

With this, bookmarks of "Title of appendix A", for example, is at the wrong location. It refers to "1.1 AB" when I want it to refer to "A. Title of appendix A."

So I change \renewcommand{\thesection}{\Alph{section}} to \renewcommand{\theHsection}{\Alph{section}}. Then bookmarks are all correct, but it now puts "1.1 Title of appendix A."

3
  • You know that this difficult to answer, having no compilable document to work with. – user31729 Mar 30 '16 at 9:10
  • I built a small document using your code and I have no problems with wrong bookmarks etc. – user31729 Mar 30 '16 at 9:15
  • @ChristianHupfer Thanks for looking in. Let me edit the question with a little more details. – BzTAK178 Mar 30 '16 at 9:26
4

The problem is that after the section values occur again and the current chapter value is still 1 (in this document version here).

This confuses hyperref, since it uses again section. as prefix for the anchors. Changing \theHsection to apply another prefix, say appendixsection. cures the problem.

\documentclass[paper=letter, fontsize=11pt, chapterprefix=on, oneside]{scrbook}
\renewcommand{\thesection}{\thechapter.\arabic{section}}
\usepackage{hyperref}

\usepackage{blindtext}

\begin{document}
\tableofcontents

\chapter{First numbered chapter}
\section{AB}
\section{BC}
\section{DE}

\newpage
\phantomsection
\addcontentsline{toc}{chapter}{Appendices}
\chapter*{Appendices}
\setcounter{section}{0}
\renewcommand{\thesection}{\Alph{section}}
\renewcommand{\theHsection}{appendixsection.\Alph{section}}
\section{Title of appendix A}
\blindtext[5]
\section{Title of appendix B}
\blindtext[5]
\section{Title of appendix C}
\blindtext[5]
\end{document}
6
  • I copied and complied your code. Although hyperref bookmarks are working great, somehow, it still says "1.1 Title of Appendix A", not "A. Title of Appendix A." – BzTAK178 Mar 30 '16 at 10:16
  • @BzTAK178: See the edit please – user31729 Mar 30 '16 at 10:17
  • That fixed it. Thank you very much for your time and help. – BzTAK178 Mar 30 '16 at 10:19
  • @BzTAK178: Thanks too. Happy TeXing! – user31729 Mar 30 '16 at 10:26
  • @ChristianHupfer Thank you Christian. You saved my day. – Sveinung May 3 '16 at 21:09

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.