I want to typeset the number for the section in the margin. Here's an MWE of what I'm starting from.
% --- Fonts ------------------------------------------------
\font\0="Roboto Condensed Light" at 12pt\0
\font\ssa="Roboto Condensed Bold" at 24pt
% --- Layout ------------------------------------------------
\raggedright
\parindent=0pt
\parskip=1em
% --- Structure ---------------------------------------------
\newcount\SectionNumber
\def\Section #1\par{%
\vskip 40pt
\advance \SectionNumber by 1
{\ssa\the\SectionNumber. #1}
\vskip 8pt
}
% Start Text
\Section Project One
\input knuth
\bye
I'm looking at this answer and trying to adapt it here, so I came up with this:
\def\inmargin#1{\strut\vadjust{\kern-\dp\strutbox\smash{\llap{#1}}\kern\dp\strutbox}}
\def\Section #1\par{%
\vskip 40pt
\advance \SectionNumber by 1
{\ssa\inmargin{\the\SectionNumber. }#1}
\vskip 8pt
}
This is close, but when the section header has descenders it seems to be incorrectly aligned. See:
As you can see, the 1. is a little below where it should be. The problem doesn't occur if I omit the descender:
I tried various contortions creating my own box and moving it around, and also trying to just kern the whole section heading negatively into the margin. I don't really care what approach is taken, I'd just like to understand what I'm missing. I suspect it has something to do with the height and depth of the section heading text.
-\wd\thebox
, and then set the title on the same baseline?:)
l3coffins (texdoc xcoffins
) has taught me everything I know;)