I’d echo Mark’s suggestion: push the maximum ragged space all the way to 0.5 or more. It’ll try more break solutions, but it’ll still try to fit the text into as few lines as it can, and doing that will also allow more space on the last line of the paragraph.
The code currently lets the last line of a paragraph include an extra ‘raggedness’ of space, and it really doesn’t like getting near the limit of that raggedness. As you saw, if you don’t allow the ‘raggedness’ to be noticeable, you’re asking it to justify the text. Actually, you’re asking it to fully justify the text, including the last line.
If you say \tracing{j}
in your ptxprint-mods.tex file, then your log will include a lot of extra stuff, and the interesting lines for this question will be looking something like this:
s@tsideskips p (p). 0.0pt/0.0pt, pf=0.0pt plus 1.0fil
s@tsideskips s1 (s1). 0.0pt plus 158.52597pt/0.0pt plus 158.52597pt, pf=0.0pt
The first 2 are how much indent plus raggedness are allowed on left / right.
That last one is the \parfillskip
and is a measure of how much space there is allowed to be on the last line of the paragraph (up to infinite for p, and no extra space for centered s1). (maybe that’s a bit harsh?? It basically says that it shouldn’t care if the last line is the longest)
s@tsideskips q2 (q2). 21.68065pt/0.0pt plus 79.26299pt, pf=0.0pt plus 79.26299p
t
For ragged-right q2, I’m seeing that the raggedness is 79.26pt, and the last line can have an extra 79.26 points, so it’ll be very unhappy at allowing more than 169.5 points of space on the final line.