I would like to set a penalty or badness for breaking a sentence (or the contents of some \command{...}
) too early. More specifically, I would like the penalty of a line break to be dependent on the position in the sentence that the line break occurs.
For example, I might want an extra penalty of 500
for breaking a sentence within the first 10em
, and an extra penalty of 100
for breaking a sentence within the last 5em
. I would then be able to tune it so that LaTeX would only break a sentence near the beginning if it really needed to.
Is this possible to achieve? Even if it requires some unbox hackery I don't really mind.
Edit:
If I could do the following pseudocode, this was what I was thinking (at the beginning of each footnote):
\setlength{\remaining}{remaining space left on line}
\setlength{\needed}{length of hbox with desired text}
\let\extrapenalty=0
\while \needed > \remaining
\if \remaining < 10em
\addto{\extrapenalty}{500}
\endif
\addtolength{\needed}{-\remaining}
\setlength{\remaining}{\textwidth}
\if \needed < 5em
\addto{\extrapenalty}{100}
\endif
\endwhile
\penalty{-\extrapenalty} % encourage break here
Background to question: I am using paragraph formatted footnotes in memoir, but I find the line breaks to be undesirable. I don't mind a long line being broken in the middle, but I find it looks particularly bad when broken at the start.
For example:
1. This is a relatively long
sentence so if it breaks in
the middle it's okay. 2. The
problem is when it's broken
right at the start. It just
looks wrong. 3. This, on the
other hand, is probably okay.
bigfoot
. It makes wonders to the typesetting of footnotes.