0

Well for our style we wish to have "small" chapters using the book style (mainly to have \frontmatter grouping)

Now the styles are mainly about where and how the numbering of the chapters happens:

For \frontmatter chapters:
"Summary"
No numbering at all, just the chapter title.

For \mainmatter chapters:
"1. Introduction"
-Normal numbering: number has to be on the same line as chapter

For \appendix chapters:
"Appendix A. Test Data"
- Number them by letters, precede the number with "appendix" has to be on same line as chapter

I've read quit a few topics about this, but I simply can't figure out how to make it work. Especially the "keeping the number on the same line" is not working for me. The best attempt I've come up with is:

\titleformat{\chapter}[display] {\normalfont\huge\bfseries}{\thechapter}{0pt}{\huge} 

But that doesn't remove the line break. It also doesn't work for appendices

I've also tried converting to the scrbook class - however that doesn't work for appendices either. (on top of that the chapter font looks really ugly).

A simple example:

\documentclass{scrbook} 
\begin{document}
\tableofcontents
\appendix
\chapter{Fluid dynamics}
\end{document}

There are 2 things "wrong" with it: first of all in the table of contents it shows as "A. Fluid dynamics" instead of "Appendix A. Fluid dynamics" (Btw I only wish the "appendix A" to be added to appendices, not for chapters like "chapter 1"). Secondly in the appendix itself it uses 2 lines.

  • Please post a complete, compilable small document demonstrating the issue so people have something to work with. Mere fragments can be useful in explanations but are not otherwise terribly helpful. – cfr Mar 5 '15 at 0:18
  • @cfr I am a bit wondering what to show then. It is not that the latex code is not working: I just have no idea how to make it work. – paul23 Mar 5 '15 at 0:19
  • @egreg editted for that - but that still gets the "appendix" wording on a seperate line. – paul23 Mar 5 '15 at 0:19
  • You need to add a minimal working example (MWE) that illustrates your problem. Just follow the link for instructions on what to include. – cfr Mar 5 '15 at 0:22
4

Since you are using a KOMA class, use KOMA's facilities for configuring things. Details are in the manual.

  • headings=small gets small headings throughout.
  • chapterprefix=false banishes 'Chapter'.
  • appendixprefix=true overrides this for the appendices only.
  • \chapterformat is redefined to add horizontal, rather than vertical space - this takes care of the chapters in the main part.
  • \chapterheadmidvskip is redefined to avoid the vertical spacing still being added in the appendices due to the use of the prefix here.
  • \addchap{} adds an unnumbered chapter which is nonetheless included in the contents.
  • \chapter*{} adds an unnumbered chapter excluded from the contents, as in the standard classes.

Code

\documentclass[headings=small,chapterprefix=false,appendixprefix=true]{scrbook}
\renewcommand*\chapterformat{%
  \chapappifchapterprefix{\ }\thechapter\autodot\quad}
\renewcommand*\chapterheadmidvskip{%
  \relax}
\begin{document}
  \tableofcontents
  \addchap{An unnumbered chapter}
  \chapter*{An unnumbered chapter not in the contents}
  \chapter{A chapter}
  \appendix
  \chapter{Fluid dynamics}
\end{document}
|improve this answer|||||
  • Well to put it frankly: I strongly prefer not to use a koma class - but instead get the koma styles in the normal book class. Especially the koma options instead of geometry break other parts. - I tried the example though and it came up with \chapterheadmidvskip not defined – paul23 Mar 5 '15 at 1:08
  • 1
    @paul23 Is your TeX distribution up to date? It is rather hard to address the other part of the comment as I'm not sure what you mean by 'get the koma styles' exactly. (Or, alternatively, what using KOMA is breaking.) – cfr Mar 5 '15 at 1:12
  • Well the "officially made" cover page for reports uses the geometry package extensively to size/position parts on the cover page. In one of the other questions I've been told geometry package is incompatible with koma styles. As for replicating I mean that for a "numbered chapter" the style in scrbook is good, but it isn't in the default book class. By having that "newline". – paul23 Mar 5 '15 at 1:16
  • For the version, we're using overleaf: overleaf.com/2341659wnyhff#/6037451 (test run there).. Is there a way to let tex print its version? – paul23 Mar 5 '15 at 1:19
  • Now I also tried it using my offline version (miktex) same problem with wit the \chapterheadmidvskip, and it reports as version: This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9) – paul23 Mar 5 '15 at 1:29

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.