bookdown-crc icon indicating copy to clipboard operation
bookdown-crc copied to clipboard

Unnumbered chapters appear twice in TOC

Open turtlegraphics opened this issue 4 years ago • 0 comments

This is an issue with the krantz.cls file, but since this repo is the best source for making a CRC krantz.cls book, I thought I should raise it here.

Unlike a latex book, krantz.cls by default includes unnumbered chapters in the TOC. As far as I can tell, this is unaffected by being part of \frontmatter or \mainmatter.

The problem does not appear in this demonstration book because the _output.yml file has the code toc_unnumbered: false to suppress the duplicate headings. You'll notice that in this demo book, the Preface does appear in the TOC. However, there are other reasons one might want toc_unnumbered: true (say, for unnumbered sections to appear).

My suggested solution is to comment out, or remove, line 717 of krantz.cls which has \addcontentsline{toc}{fm}{#1} in the definition of \@schapter. That will make krantz.cls behave more like the normal latex book class and requires unnumbered chapters to be explicitly included in the TOC. Since bookdown handles the TOC for unnumbered chapters and sections, this makes krantz.cls behave better with bookdown.

If there's a better approach I'd love to hear it, or if this seems like the right fix then it would be helpful to change it in this repo.

turtlegraphics avatar Jan 09 '21 23:01 turtlegraphics