1

I'm preparing a book type project for which I'm trying to ensure the number of lines per page fits exactly the height of the typeblock, so that the lines are aligned on the two pages of the spread, and overleaf. With no \raggedbottom as you can presume.

For the main text, KOMA-Script's typearea, which I'm using, handles this flawlessly and I get a typeblock that fits an exact number of lines. However, I'm using enotez for an end notes chapter, which I've chosen to typeset in \small font size. And there's no reason that the \textheight calculated by typearea for \normalsize will fit an exact number of lines for whole pages typeset \small, and indeed, they don't.

I'd like to achieve the same alignment effect of the main text for the endnotes by slightly adjusting the leading, so that the end notes chapter also fits an exact number of lines. However, I can't seem to manage, thus the question.

The book's normal fontsize is 11pt, using scrbook class with DIV=12 and papersize 234mm:156mm.

\documentclass[11pt]{scrbook}

\KOMAoptions{
  paper=234mm:156mm, % small royal octavo
  DIV=12, % DIV calls '\typearea' and recalculates it.
  headings=normal, % less large headings.
}

The endnotes are set with enotez using a custom enumitem environment derived from description. I set parsep=\parskip, and itemsep=0pt, to (supposedly) remove vertical space between the items, but allowing for some glue with \parskip. I'd expect this would correspond to the vertical spacing behavior of regular paragraphs (though I'm probably wrong).

\usepackage{enumitem}

\usepackage{enotez}
\setenotez{
  list-heading=\addchap{#1},
  list-style=customendnotes,
  split=chapter,
  backref,
  reset,
}

\newlist{customendnotes}{description}{4}
\setlist[customendnotes]{
  leftmargin=1em,
  listparindent=1em,
  labelsep=.2em,
  parsep=\parskip, % 0pt plus 1pt
  itemsep=0pt,
  % noitemsep, % sames as parsep=0pt,itemsep=0pt => underfull vboxes...
}

\DeclareInstance{enotez-list}{customendnotes}{list}
  {
    list-type = customendnotes,
    format = \small,
  }

Now, \normalsize gets a 10.95pt font with 13.6pt leading (\baselineskip), \small is 10pt font with 12pt leading. typearea sets a \textheight of 500.6pt.

For the main text: (500.6 + (13.6 - 11)) / 13.6 = 37, a round 37.

For the end notes: (500.6 + (12 - 10)) / 12 = 41.88333.

So, the typeblock should be able to accommodate almost 42 lines, but 41 full ones. I'd like to increase the leading a little there, so that this page would fit exactly 41 lines.

So I thought: ((500.6 - (41*10)) / 40 ) + 10 = 12.265pt (inverting it (500.6 + (12.265 - 10)) / 12.265 = 41, which checks)

Thus, 12.265pt is the theoretical leading I want. I try to set it with \linespread. {\small \linespread{1.02208333333}\selectfont \the\baselineskip} gives me 12.26495pt, close enough.

However, the problem is that the above reasoning is somewhere flawed, for the end notes pages, typeset in \small, do not fit 41 lines at all, but 39 or 40, depending on the case. As a result, of course the lines are misaligned between the two pages of the spread (I am giving some glue to parsep, but removing it would just result in underfull vboxes). I presume I'm missing some vertical parameter of the list environment, but I really can pin down why. And, not understanding where the vertical space comes from, I fail to get my numbers right.

So, the question is, why does this page not fit 41 lines, as I'd expect? And how could I calculate (and set) correctly the leading for this chapter's pages so that if fits an exact number of lines in the typeblock?

A MWE example putting things together.

\documentclass[11pt]{scrbook}

\KOMAoptions{
  paper=234mm:156mm, % small royal octavo
  DIV=12, % DIV calls '\typearea' and recalculates it.
  headings=normal, % less large headings.
}

\usepackage{enumitem}

\usepackage{enotez}
\setenotez{
  list-heading=\addchap{#1},
  list-style=customendnotes,
  split=chapter,
  backref,
  reset,
}

\newlist{customendnotes}{description}{4}
\setlist[customendnotes]{
  leftmargin=1em,
  listparindent=1em,
  labelsep=.2em,
  parsep=\parskip, % 0pt plus 1pt
  itemsep=0pt,
  % noitemsep, % sames as parsep=0pt,itemsep=0pt => underfull vboxes...
}

\DeclareInstance{enotez-list}{customendnotes}{list}{
  list-type = customendnotes,
  format = \small,
}

\AddToHook{env/customendnotes/begin}{\linespread{1.02208333333}\selectfont}

\usepackage{lipsum}
\usepackage{showframe}
\usepackage[hidelinks]{hyperref}

\ExplSyntaxOn
\NewDocumentCommand \testchapter {}
  {
    \prg_replicate:nn { 25 }
      {
        \lipsum[1]\endnote{\lipsum[][1-5]}
        \lipsum[1]\endnote{\lipsum[][6-14]}
        \lipsum[1]\endnote{\lipsum[][15-16]}
        \lipsum[1]\endnote{\lipsum[][17-25]}
        \lipsum[1]\endnote{\lipsum[][26-28]}
        \lipsum[1]\endnote{\lipsum[][29-40]}
      }
  }
\ExplSyntaxOff

\begin{document}

\makeatletter
\newcommand\thefontsize[1]{{#1 The current font size is: \f@size pt\par}}
\makeatother

\thefontsize\normalsize % 10.95pt
\thefontsize\small %10pt

\the\textheight % 500.60022pt

\the\baselineskip % 13.6pt

{\small \the\baselineskip} % 12pt

{\small \linespread{1.02208333333}\selectfont \the\baselineskip} % 12.26495pt

\tableofcontents

\chapter{Chapter 1}

\testchapter

\chapter{Chapter 2}

\testchapter

\printendnotes

\end{document}

Edit: I think I have found the main culprit, but not all of it. enotez, to support hyperref links, adds a raised link with a hardcoded height of 1em, and this accounts for the spaces between items I was finding. This can be fixed using:

\cs_set_protected:Npn \enotez_write_list_number:n #1
  {
    \bool_if:NT \l__enotez_hyperfootnotes_bool
      {
        % \box_move_up:nn {1em} { \hbox:n { \hypertarget {enz.#1} { } } }
        \Hy@raisedlink { \hypertarget {enz.#1} { } }
      }
    \tl_use:N \l__enotez_list_number_format_tl
    \bool_lazy_and:nnTF
      { \l__enotez_hyperfootnotes_bool }
      { \l__enotez_hyperbackref_bool }
      {
        \exp_args:Nnx
        \hyperlink {enz.#1.backref}
          { \exp_not:V \l__enotez_endnote_mark_tl }
      }
      {
        \str_if_eq:neTF {a} { \prop_item:Nn \g__enotez_endnote_man_prop {#1} }
          { \prop_item:Nn \g__enotez_endnote_mark_prop {#1} }
          { \exp_not:V \l__enotez_endnote_mark_tl }
      }
  }

With this, now the 41 lines do fit. However, if I set the \linespread to the theoretical value I had calculated (\linespread{1.02208333333}, to achieve leading of 12.265pt) the 41st line jumps to the next page again. Trial and error suggests the highest I can go is \linespread{1.0199966} (resulting in \baselineskip of 12.23987pt). I'd still love to know why the difference.

1 Answer 1

0

The adjustment of the raised hyperlinks of enotez was suggested upstream (https://github.com/cgnieder/enotez/issues/42), has already been implemented and will be available on the next release (the current is v0.10d of 2022/01/04).

You must log in to answer this question.

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