5

I stumbled upon an interaction effect between lineno.sty and \widowpenalty and \clubpenalty. It's good to put this into a record that is searchable here:

\documentclass[12pt]{article}

\widowpenalty=200000 %/150/ No Widows at top of page \clubpenalty=100000 % this is really orphanpenalty. No orphans at bottom of page

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{lineno} \linenumbers

\begin{document}

\title{The IPCC Shared Socioeconomic Pathways (SSPs): Explained, Evaluated, Replaced?}

\author{anonymous}

\date{\today}

\maketitle

\begin{abstract} Shared socioeconomic pathways are perhaps the most influential \emph{economic policy} analyses today. Yet, their design is problematic. Moreover, all five SSP baseline scenarios are based on empirically exceedingly improbable scenarios. An alternative --- econometric time-series analysis based on worldwide IPAT components --- suggests alternative \emph{emission} scenarios, mapping into expected radiative forcing of about RCP~6.5, with a reasonable high-plausibility range from RCP~4.5 to RCP~7.0. \end{abstract}

\end{document}

gets you

incorrect line numbers

removing the two penalty lines gets you the correct output

correct output

Suggestion: It would be nice for lineno.sty to warn or err if it detects a penalty that it has problems with. just took me a while to isolate this.

ivo Welch
  • 3,766
  • 2
    I think you need to phrase this as a question and answer it – David Carlisle Jan 30 '24 at 22:08
  • 1
    The maximum penalty supported by TeX is 10000 so the penalties you specify in your preamble are too high, and won't improve anything. – barbara beeton Jan 30 '24 at 22:21
  • 1
    as @barbarabeeton says setting above 10000 (which works with lineno) can never do anything useful and in fact it can completely break things. if you think the output you show is bad try this example with both set to 70000 :-) – David Carlisle Jan 30 '24 at 23:15
  • 1
    lineno uses extensively large penalties in order to do its work. It doesn't expect that \widowpenalty or \clubpenalty are set to such large values as you do. – egreg Jan 30 '24 at 23:28
  • bigger is not always better...(lineno could issue a warning if it detects this. just was an unexpected interaction.) – ivo Welch Jan 31 '24 at 17:14

1 Answers1

4

The TeXbook says that a penalty of −10000 in vertical mode forces a page break, but you find in plain.tex

\def\supereject{\par\penalty-20000 }

(actually -\@MM, but it's the same) and uses \supereject in the definition of \bye

\outer\def\bye{\par\vfill\supereject\end}

If we analyze the output routine, we see that this large penalty is used as a signal. In the particular case it triggers flushing the insertion queues. A −10000 penalty would be sufficient to force the final page break, but TeX records the exact value that was used, so it can branch cases.

A very similar mechanism is used by lineno.sty to disassemble lines before outputting them in order to add the line number. For instance, at some point it sets \interlinepenalty to −100000, in order to send signals. But in the presence of a \widowpenalty of 200000 its calculations are completely ruined. Very interesting code, by the way.

If you want to disallow widow and club lines, just use 10000 (but this isn't a good value anyway).

egreg
  • 1,121,712