Consider the code below. The distance between the chapter title and the baseline of the following text is font dependent. I assume that there is a glue between the chapter title and the top of the first row. When I insert a \strut
at the beginning of the paragraph, the distance seems to be fixed (which makes sense, as the strut is always the same, regardless of the current font.
How can I fix the problem, that the distance between the chapter title and the base line of the first text row is font dependent?
Can I insert a \strut at every par? Can I say "x pt distance to then next baseline"?
\documentclass[11pt]{book}
\usepackage{lipsum,xcolor}
\usepackage{mathpazo}
% \usepackage{lua-visual-debug}
\usepackage[showframe]{geometry}
\usepackage{titlesec}
\titleformat{\chapter}[hang]{\fontsize{20bp}{20bp}\selectfont}{\thechapter}{1ex minus .1ex}{}
% without strut at the beginning of first paragraph
% \titlespacing*{\chapter}{0cm}{\dimexpr -\topskip }{6.5bp}[0pt] % mathpazo
% \titlespacing*{\chapter}{0cm}{\dimexpr -\topskip }{6.9bp}[0pt] % mathptmx
% with strut at the begining of the first paragraph
\titlespacing*{\chapter}{0cm}{\dimexpr -\topskip }{6bp}[0pt] % mathptmx + mathpazo
\renewcommand\normalsize{\fontsize{9bp}{10bp}\selectfont}
\parskip0pt
\usepackage{atbegshi,picture}
\makeatletter
\AtBeginShipout{%
\AtBeginShipoutUpperLeft{%
\put(\dimexpr
\ifodd\value{page}\oddsidemargin\else\evensidemargin\fi + 1in\relax,
-\dimexpr\topmargin + 1in + \headheight + \headsep\relax){%
\begin{picture}(0,0)%
\setlength{\unitlength}{10bp}%
\setlength{\dimen0 }{0pt}%
\@whiledim\dimen0<\dimexpr\textheight+1sp\relax\do{%
\put(0,-\dimen0){\color{green}\line(1,0){\textwidth}}%
\addtolength{\dimen0 }{\unitlength}%
}%
\end{picture}%
}%
}%
}
\makeatother
\begin{document}
\chapter{Chapter title}
%\strut
\lipsum[1-3]
\end{document}
ex
depends on the current font; first of all, don't use1ex
to set the spacing.\titleformat
).\lineskip
glue to be inserted, whenever that happens you fall off the grid. I think if you could get titlesec to smash the depth of its heading row so lineskip is never used (and rely on the after-heading glue to ensure that the smashed descender never over prints) then baselineskip rather than lineskip will be used