How to get 'unbalanced' and unjustified paragraphs?

I’m creating an output for a bunch of study Bible content. In this layout, all of the notes are left justified paragraphs with a hanging indent.

What I’m puzzled about is how to tell PTXPrint / TeX that I do not want to have a kind of balancing of lines happening. You can see what I mean in the screenshot below for 1.8 and 1.22. There is plenty of room on some lines for more text.

If I set the style for these paragraphs to Justified, this issue goes away (as much text as possible is fit on the line).


I have tried fiddling with the Maximum Ragged Space for the style for these paragraphs. A minimal change is possible (except if I apply zero, then PTXPrint essentially justifies the text).


What else would I need to do to have lines fill as much of the measure as possible before breaking to the next line?

Hi @jklassen! Yes, that certainly looks strange and I am not (yet) sure what might be causing it. I have tried adjusting the settings for another Study Bible and find that it works as I would expect (admittedly with 2-col layout of the \ef extended footnotes, rather than 1-col layout):

I wonder if you have tried increasing the Maximum Ragged Space to something like .65 to see if that allows the bottom line to have fewer words on it and the top line to fill out a bit more, like you’ve expect.

I that doesn’t solve it, we’ll have to wait to see what @David_Gardner or @Martin_Hosken have to say about it.

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

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.

Thank you Mark, and David for considering this, and for the details on how this is operating in TeX, David.

I have paragraphs for notes which I have created a marker for called \zefp. I have set this up as a hanging indent (left indent factor of 0.18em, and -0.18 for first line).

The page size is A4 (210mm wide - margins of 14mm = 28 total) – so a text width of 182mm

If I leave the default ‘max ragged space’ of 0.25, the the log shows:

s@tsideskips zefp (zefp). 10.40648pt/0.0pt plus 129.46004pt, pf=0.0pt plus 129.

(about 45mm max space on last line)

If I set max ragged space to 0.65, the the log shows:

s@tsideskips zefp (zefp). 10.40648pt/0.0pt plus 336.59294pt, pf=0.0pt plus 336.

(about 118mm max space on last line)

which, I guess, explains why TeX is not allowing more of the second line in the note for 1:8 to remain on the first line.


How can I configure things to get the same properties being allowed for ‘p’ (from your description, David, of pf=0.0pt plus 1.0fil) to be applied to my invented \zefp? I want to also allow ‘infinite’ space on the last line.

Hmm. I tried to reply by email, but it got bounced.

The 1.0 fil is (currently) applied to justified paragraphs. I get the feeling that we might need some extra setting.

I don’t understand why 0.65 isn’t big enough. Maybe it’s compared to column width rather than current width?? But anyway, it looks like you probably want to push the ‘raggedness’ up to 1.0 (or even 2? As far as TeX is concerned it’s just maths, but I expect the user interface won’t be happy and you’ll probably have to use the ptxprint-mods.sty to put that in).

If that doesn’t work, what you could probably do is add a hook something like this:

\sethook{zefp}{end}{\hskip 0pt plus 1fil }

(assuming I got the parameter sequence right)

Thanks for exploring this with me, David.

I can’t set the parameter higher 1. I’ve tried that, and it does not cause any change.

I tried the hook. (I needed to reverse the position and marker order :slight_smile: )

\sethook{end}{zefp}{\hskip 0pt plus 1fil}

but no change. I’m confident that the hook works because I can just insert some text there and it comes through – and if I insert enough extra text, some of the text on the first line of this paragraph starts to come down to the second (to be more balanced).

That’s frustrating. TeX does discard things at the end of lines (so that e.g. you don’t end up with spaces at the end of lines in justified text), and I guess that is what’s happening here. So, some more tries:

% Option1: set the paragraph fill to what we want, then end the paragraph before the code can put it back (this might break things):
\sethook{end}{zepf}{\parfillskip=0pt plus 1fil \endgraf} 
% Option 2: No line break, Lots of stretch, no line break and then a zero width line(which will neither be visible nor discarded).
\sethook{end}{zepf}{\penalty 10000\hskip 0pt plus 1fil \penalty10000\vrule width 0pt depth 0pt height 1pt}
1 Like

Thank you, David.

Both of these suggestions are working! I’ve kept Option 1 enabled.

Thank you to each of you for pursuing this until a solution could be discovered. MH got very close to the identical solution a couple of days ago, but without that final \endgraf it didn’t seem to make any difference. I’m glad we now have a concrete way forward.

I’m also wondering whether we need a switch somewhere in PTXprint that would make this the default behavior for one or more (a list of) markers.

The problem with the \endgraf in there is that it will cause problems in certain circumstances. In normal text it is probably fine, but only probably

I think that the ‘one true solution’ might be to have more justification options:
1: justifed, 2: right justified, 3 right-rigid,
4: centered, 5: centred-rigid, 6: left,
7: left-rigid, 8: left-fill, 9: left-rigid-fill
(where rigid = rigid spaces)

I’ve thrown in the ‘rigid’ options , thinking that some some people might assume that goes with ragged left/right options.

Note that there’s no way I know of to have any extra ‘fill’ in the last line of a right-justified paragraph, which is why the lines in 2,3 are different to the 6,7.

I’m grateful for the solutions, David. Thank you.

If I may, I’ll share an opinion here, somewhat subjective as it may be. I think that Alignment: Left should mean the rigid setup, by default. I think that this is what is likely anticipated by a person choosing unjustified text – and it presents the text in the form which is potentially most readable (consistent word spacing being the concern in that view). Of course a very ragged left (or right) edge could be a readability concern, which might be related to a narrow line length. Softening that could be done through hyphenation, and perhaps through an option to “soften the unjustified / ragged edge?” which would apply some stretchability to the word spaces to create a smoother edge.

Again - my thoughts on defaults. I’m sure there are other opinions. Regardless - having a simple way to achieve ‘rigid’ will be quite helpful.