Forum How do I...?

2 hyphenation questions: last line and controlling phrases

jbzech
I'm still a little new here, but picking it up. I have two hyphenation controls I'd like to enable, if possible. Otherwise, I'll put in a feature request.

1) I have several instances in my long document in which the last word of a paragraph is hyphenated (meaning that the second half of the word is dangling down there on it's own line at the end).

Is there any way to prevent that on a global level?

2) It's house style, more or less, to never break certain phrases that come up in our work. For example, we don't like to break a person's title from his/her name: "Professor Clark". Is there a way to build a global rule to keep together certain phrases? (such as "Never break between "Professor" and the word that follows it.")

Thanks for the help in advance,

jz
mikeday
Is justification enabled in your document? This makes Prince use a different line breaking algorithm, which may produce different results. At the moment the only way to prevent breaking after a particular word would be to replace the space with a non-breaking space, either manually or using JavaScript.
jbzech
Thanks, Mike.

I do have justification enabled. Does that mean I can't use justified text AND prevent last line word breaks? If I don't use justification, it won't break those last words?
jbzech
I just ran the same file and 2 of the instances I'd identified in my document still occurred with text-align:left.

Is there a way to prevent this?
mikeday
At the moment, only the non-breaking space can prevent it. Could you perhaps email me a sample document showing the bad break? Perhaps we can improve it in a future release.
jbzech
The issue that is the major one for me (non-breaking spaces are not problem) is the hyphenation of the last word of a paragraph.

EX:

My paragraph is going along fine,
but this is the last line of a para-
graph.


My only solution at the moment would be to single out the paragraphs in my document that have these bad widows at the end and turn off hyphenation for just those paragraphs. But it's a pretty inelegant solution. Anyone have a better one? Or am I doing something wrong that I'm getting these hyphenations?
  1. badbreak.png7.8 kB
jim_albright
I don't have a solution either. I really need this. I have a manual way of adjusting the tracking to fix this type of problem but as you say inelegant. [program name is Princess] Even worse is when the hyphenation occurs at bottom of right hand page. There really should be automatic solutions to these problems.

Jim Albright
Wycliffe Bible Translators

dauwhe
Could you wrap the last word of a para in a span (possibly via XSL or JavaScript) and set that span not to hyphenate?

<p>The last word of the <span class="nohyphens">paragraph</span></p>


span.nohyphens {
hyphens: none;
}
jbzech
That's another good workaround idea. Thank you. It probably works better than my earlier idea because, at least, it's global.

The only problem there is that I end up with all kinds of extra spans cluttering up my source files, which I'd like to prevent. What I'd really love is a CSS rule in which you can at least set the minimum characters allowed on the last line of a paragraph.