2

I'm writing a book using amsbook. The book is divided into two parts: a part called "Basic topics" that roughly speaking corresponds to a course I teach, and a part called "Essays" that contains a number of loosely related essays giving applications, extensions, etc of the basic topics.

I would like to have these numbered independently, with the chapters numbered with numbers and the essays numbered with letters. Here's what I mean:

  • Part 1: Basic topics
  • Chapter 1: chapter title
  • Chapter 2: chapter title
  • ...
  • Chapter n: chapter title
  • Part 2: Essays
  • Essay A: essay title
  • Essay B: essay title
  • ...
  • Essay Z: essay title

I can change the behavior of chapters at the start of Part 2 to make them called "essays" and to have them enumerated using letters instead of numbers, but then they don't start with A but rather with the letter corresponding to n+1, where n is the number of the last chapter in Part 1. If I reset the counter, all the internal hyperlinks get screwed up.

Here is a minimal working example:

\documentclass{amsbook}

\usepackage{etoolbox}
\makeatletter
\patchcmd\@part{\protect\enspace\protect\noindent}{\hspace{.5em}}{}{\ERROR}
\makeatother

\usepackage{hyperref}

\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]

\begin{document}

\part{Basic topics}

\chapter{First chapter name}

\chapter{Second chapter name}

\part{Essays}
\renewcommand{\chaptername}{Essay}
\renewcommand{\thechapter}{\Alph{chapter}}
\setcounter{chapter}{0}

\chapter{First essay name}

\end{document}

When this compiles, hyperref throws a warning that there is a "destination with the same identifier". If I delete the line "\setcounter{chapter}{0}" it screws up the lettering of the essays.

7
  • @JohnKormylo: That doesn't seem to do anything (though I don't really know what theHchapter is as opposed to thechapter). If I put \renewcommand{\chaptername}{Essay} and \renewcommand{\thechapter}{\Alph{chapter}} at the beginning of the new part, it changes the chapter names to Essay <letter>, but the lettering doesn't start with A since it's still using the same counter as the previous chapters. Commented 13 hours ago
  • Try \renewcommand{\theHchapter}{\Alph{chapter}} in the new part, or possibly \renewcommand{\theHchapter}{\theHpart.\arabic{chapter}} over the whole thing. Note, this just keps hyperref good. You still need to reset the chapter counter. Commented 13 hours ago
  • @JohnKormylo: Sorry for the out-of-order comments -- I think you deleted and reposted yours as I was typing my reply. Wouldn't resetting the chapter counter screw up the hyperref's? Commented 13 hours ago
  • Hyperref uses \theHchapter to name the chapter anchors (instead of \thechapter). Check the aux file (\newlabel etc) to see what the anchor names look like. Commented 13 hours ago
  • @JohnKormylo: Weird, I'm using hyperref but making theHchapter Alph does nothing while making thechapter Alph has the intended effect. Commented 13 hours ago

1 Answer 1

3

The hyperlinks for chapter 1 and essay A work for me.

\documentclass{amsbook}
\usepackage{hyperref}

\begin{document}
\tableofcontents

\part{book}
\chapter{book stuff}
\part{essays}
\setcounter{chapter}{0}
\renewcommand{\chaptername}{Essay}
\renewcommand{\thechapter}{\Alph{chapter}}
\renewcommand{\theHchapter}{\Alph{chapter}}
\chapter{on a lump of putty found in my armpit one summer's morning}
\end{document} 
2
  • Weird, renewing \thechapter and \theHchapter really does seem to fix everything. I don't understand why this worked, but I guess it is the solution. Probably I need to go and read more about hyperref. Commented 12 hours ago
  • @AndyPutman It works because that macro is the one that controls how the names of the "anchors" to which the hyperlinks point is formed. If you reset the counter without changing it, you have repeated names...
    – Rmano
    Commented 4 hours ago

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.