0 votes

Consider this rather ghastly line in some fully justified text:

You can see how it has been truncated, or at least there is extra space to the right. This is because I have turned off letter spacing for this example. There is no better line break (for the purposes of this discussion) and so there is nowhere to insert extra space and so we get an under full box. But who would do this. Surely they would turn on letter spacing. So let's turn on a tiny amount: 0.5%:

Yuk. That's way more than 0.5% maximum stretch. What's going on? Well XeTeX needs to decide what to do about spacing a really bad break like this. In fact it has a special pass that in effect says to the line breaker: you have an extra 1in per line (set via \emergencystretch=1in by default) so if you can justify based on that, go for it. And 0.5% adds just enough intercharacter space to get us under needing 1in extra space. Now the line is spread out and all that emergency stretch is distributed among all those stretches, regardless of any maximum we might have set on the stretch, and the intercharacter space looks super wide and spread out.

Is this the best we can do? Consider yourselves blessed all those who work with shorter 'words' and don't have to deal with lack of interword breaks. Thankfully this text is marked with wordbreaks which are turned into ZWSP. ZWSP is defined as taking the intercharacter spacing, so we can be sneaky and turn of letter spacing while still keeping the intercharacter space for ZWSP. We do this by adding the line:

```

\def\intercharspace{\leavevmode\nobreak\hskip\intercharskip}

```

to our ptxprint-mods.tex (since turning off letter spaces comments it out from the job .tex file). Now what do we get if we turn off letter spacing again?

Hmm not much better but at least the text is broken on words rather than grapheme clusters. This may or may not be preferable. But there is no nice solution. This is about making the best of a bad job.

Comments welcome so long as you don't say: don't break there then! (Which of course is the right solution, but may not always be available given the time we have)

PTXprint by (366 points)

2 Answers

0 votes

If I'm understanding properly...
1. Normally, ZWSP has as much space as the inter-letter space, so that words joined by it don't end up closer than the letter spacing.
2. Currently, turning off inter-letter spacing also skips the definition of \intercharspace, so ZWSP is actually zero width.
3. For the above you're suggesting that by making ZWSP have some space is the worst of the bad situation.
4. And to do that, you're setting the \intercharspace macro to non-blank, (as that macro's always used in the definition of ZWSP), but because inter-letter spacing is off, it's not actually getting used in the interchar postition.
OK I think I get it now!
 

by (707 points)
0 votes

And in true soap opera fashion, to finish on a note of relief for all those who are pained by the sight of such badness. Reducing the text width to 95% of character width we get the next word up:

phew! But another time the word could be longer and the compression needed starts to get silly. So you can't always get away with it.

Also, the discussion regarding emergency stretch wasn't strictly correct. Yes the emergency stretch gets added to the line box to get its badness down. But the reason we needed the intercharacter spacing to be at least 0.5% is that ptxprint has a bug that means any value below that becomes 0. That bug HAS BEEN FIXED! grr.

by (366 points)
edited by

Related questions

Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
For just as each of us has one body with many members, and these members do not all have the same function, so in Christ we, though many, form one body, and each member belongs to all the others.
Romans 12:4-5
2,626 questions
5,364 answers
5,041 comments
1,420 users