I'd like some of those "flaps" (how are these really called in typography, actually? Is it "thumb index"?) which is a bit of fill, extending to the margin; so that when you "bend" a book, you can see more easily where a section is - something similar to:
- Color background for chapter titles which stretches horizontally to the margins
- Chapter Title in rotated vertical box at the margin
... except for sections - so something like Vertical color background of section title, except for only the first line of the section (or in general, a fill with a fixed width, aligned with the first line of the section).
I thought I could use tikz
for this, so I prepared this MWE:
\documentclass[10pt,twoside,openright]{book}
\usepackage{titlesec}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{fit}
\usetikzlibrary{external}
\titleformat*{\section}{%
\normalfont\Large\bfseries\color{black!90}%
\tikzexternaldisable%
%\tikz\node(AA){A};% ! Package titlesec Error: Entered in horizontal mode.
\tikzexternalenable%
}
\begin{document}
\frontmatter
\mainmatter
\part{Introduction}
\chapter*{The first chapter - without thinking anything else}
\section{The first section - and some more text inside; and some more text inside; and some more text inside}
Blah, blah, blah...
\end{document}
The output - along with my desired effect, which I've helpfully :)
indicated in red - looks like this (click for full res):
As the source notes, as soon as I start putting in \tikz\node(AA){A};
nodes for testing, I get ! Package titlesec Error: Entered in horizontal mode.
.
Is this possible to solve, without having to include the tikzmark
or tikzpagenodes
packages?
As a subquestion, is it possible to solve so that the "flap" extends from the section to the outer paper edge - regardless if the section ends up on left-hand or right-hand page? (I'm still primarily interested in a "complete" line margin-to-margin, except with a break along \textwidth
- which implies two rectangle nodes)...
A
?A
is just a dummy text I entered for testing, when I first starting getting errors for empty node text{};
- I should have removed it, but nevermind now...tikzpagenodes
ortikzmark
? Any particular reason to avoid making life easier for yourself?