“Non-sciency” chapters and sections in a LaTeX book

One of my “customers” wanted a book that didn’t look so “sciency” (i.e., less like LaTeX). The first few tweaks (described in my last post) were more general, this one deals with the look of chapter and section headings.

I use the package titlesec for the task:

\usepackage{titlesec}

Each chapter should start on its own page. On top it will say “Teil X”, then a line, then the chapter name centered. At the bottom of the page a picture is included. This is the code for it:

\titleformat{\chapter} % command
[display] % shape: display, block, runin, hang (default)
{\bfseries\Large\itshape} % format
{\thechapter} % label
{0.5ex} % sep btw. label and title body
{\rule{\textwidth}{1pt} \vspace{1ex} \centering} % before-code
[{\vfill\includegraphics[width=\linewidth]{\Chapterimg}\pagebreak}] % after-code

The image for a chapter is set before each chapter with the custom-defined command Chapterimg:

\def\Chapterimg{img/chapterimage6}
\chapter{Einleitung}

A section is just the title in large bold font, no number in front of it:

\titleformat{\section} % command
[block] % shape
{\usekomafont{title}\large} % format
{}  % label
{0pt} % sep 
{} % before-code
[] % after-code

I also adjusted the spacing a bit:

\titlespacing{\section}{0pt}{1ex}{0pt} % less space for sections
\titlespacing{\subsection}{0pt}{0pt}{0pt} % subsection is like a paragraph

In a previous version of the book, the images were supposed to be placed next to the section headings. My attempt at doing that was to include the image in the “after-code” of the section format and add a bit of space at the right margin for it. It looked ok, but there were some issues with one-line vs. multi-line titles that I didn’t fix, because the images moved to the chapters instead.

[{\vspace{-3em}\hfill\includegraphics[width=4em]{\Chapterimg}\hspace{-5em}~}] % after-code
\titlespacing{\section}{0pt}{1ex}{0pt}[6em] % left margin / before / after / [right]

A “non-sciency” LaTeX book

One of my “customers” wanted a book that didn’t look so “sciency” (i.e., less like LaTeX). So here are a few tweaks to match their expectations.

Chapters should have letters as references with the prefix “Teil”:

\renewcommand{\thechapter}{Teil \Alph{chapter}}

Sections have the letter, a hyphen and the number:

\renewcommand*{\thesection}{\Alph{chapter}-\arabic{section}} 

Figures have no numbers, only the caption text below (using the package caption):

\usepackage{caption}
\captionsetup[figure]{labelformat=empty,textfont=footnotesize}
\renewcommand{\thefigure}{}

The first line of a paragraph is not indented. To compensate, the space between paragraphs is bigger:

\setlength\parindent{0pt}
\addtolength\parskip{4pt}

The header line of a page contains no section, but only the name of the chapter (using the package scrlayer-scrpage):

\usepackage{scrlayer-scrpage}
\clearpairofpagestyles % empty default header/footer markings
\automark[chapter]{chapter} % only chapter as mark
\ihead{\headmark} % inner margin has name of chapter
\ohead{\pagemark} % outer margin has page number