This question illustrates what I'm trying to achieve: Dots in table of contents as on a chess-board

Notice that each row of dots is offset, creating a Chinese Checkers board-like pattern.

However I've tried it, and am having trouble achieving it. Is there a relatively simple way of doing this with KOMA-Script classes?

enter image description here

  • 1
    Can you please show us the actual code of what you've tried so far as an MWE?
    – Skillmon
    Commented Jan 30, 2020 at 23:08
  • TeXbook p. 224 (on \leaders): “The infinitely replicated boxes are lined up so that they touch each other, and so that, if you could see them all, one of them would have the same reference point as the smallest enclosing box.”
    – frougon
    Commented Jan 30, 2020 at 23:40

1 Answer 1


I found the answer in the TeXbook source code (I hope this is not a violation of copyright, as the information is publicly available. If it is I will immediately remove my answer). I'm still dissecting how it works and learning TeX, so if anyone is willing to help explain that would be great.


% from TeXbook source: 
%  https://ctan.org/pkg/texbook?lang=en
%   /systems/knuth/dist/tex/texbook.tex

\countdef\counter=255  % define a new counter at register 255
\def\diamondleaders{\global\advance\counter by 1  % increment above counter every time this command is called
    \ifodd\counter \kern-10pt \fi  % says how far away initial dot can be, adds offset to kern (horizontal space) (?)
    \leaders\hbox to 20pt{\ifodd\counter \kern13pt \else\kern3pt \fi  % define a leader, still learning how these work
        .\hss}\hfil}  % hf
    %                ^(distance between dots)   ^  these show the ^ relative displacement between the two ??
    % from toying with the settings, I've found that adjusting 13 and 3 to the same value makes the dots a square grid
    % I assume the 20pt is the spacing between the dots, and the 13 / 3 is some additional displacement if odd of even

\RedeclareSectionCommand[toclinefill=\diamondleaders]{section}% can repeat this for sub, subsub, etc.


enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .