0 votes

I want to break a section heading differently, so as not to split a phrase: 

Change       to     

I can achieve this by entering a tilde directly into the USFM GEN text: 'i~Sodom'. But I don't want to change the text of this project. For verse text this pattern works in changes.txt (LO screenshot so the non-breaking space appears grey):

But I can't get the non-breaking space into my section heading into PTXprint via changes.txt. I have tried all nine permutations below of NBSP marker and verse#. What am I missing?

Related question: How to enter a UTF code into changes.txt, as in my GEN 23:2 example?

PTXprint by (630 points)

1 Answer

0 votes

Yes, there are several ways of doing what you are asking for. First decide whether you want to create a rule that KEEPS elements together (and could therefore be a more generic rule to apply everywhere), or one that forces words to SPLIT APART (tends to be very location specific).

In line 6 (currently commented out with a #) I have shown how you would keep 2 words together using the ~ tilde in order to force them onto the same line.

In your case the simplest rule would look like this:

at GEN 19:0 'i Sodom' > 'i~Sodom'

In line 8 I have shown a rule that encourages the line to break at a certain point using the // instead of a space. Again, this would look like this:

at GEN 19:0 'tou i' > 'tou//i'

Notice that because we're being so specific with the location GEN 19:0 (= the part of chapter 19 which comes BEFORE verse 1) we can use just part of the word (mamantou); and although I usually like the use of (capture) (groups) and "\1//\2" using numbered group replacements, it ends up as more work - hence the simple rule that I suggest above.

Interestingly, sometimes // won't split the line due to calculated penalties etc. and you might need to use a forced Line Separator instead, as seen on line 9. And even more curious is that the regular Line Feed (\u000A) didn't work at all - but I have no idea why. Perhaps someone else can explain that.

There is one other complication - if you are trying to use ~ tilde but it isn't working, have a look at the TeXpert Hacks to see if this setting is enabled (which should help):

by (2.6k points)
Many thanks, Mark. Very helpful!

My first question was whether the verse 0 reference was valid. You answered that one right away, and I've got it working in this instance now.

I had already tried // here and in a couple of other trials, but it hasn't worked in this PTXprint project, as you suggested. Perhaps because of 2-column format with long words?

Your comment about group replacements: I found my basic rule useful as a template for several specific paragraph endings, but I don't know the language well enough to simply replace '[space]i[space]' > '[space]i[nbsp]' everywhere. So the \1\u00A0\2 string has been a timesaver.
The issue with // is that it is a discretionary, not forced break. This is wonderful most of the time, it means that users can mark good places to break a heading if the code needs to break and it won't if there's space for the full line. It *does*, however, obey the 'maximum ragged space' for the paragraph style. If its not doing what you want it to do, then try increasing that.

U+000A is not obeyed, as it's explicitly defined as being indistinguishable from a space in USFM documentation. That way people don't get unexpected paragraphs in the middle of their text, before each verse, etc.

Related questions

Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
There is neither Jew nor Gentile, neither slave nor free, nor is there male and female, for you are all one in Christ Jesus.
Galatians 3:28
2,628 questions
5,369 answers
5,045 comments
1,420 users