cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Widows in paragraphs and xrefs

bfriesen
16-Pearl

Widows in paragraphs and xrefs

Is there a way to set how many characters are left in a row. I have found in the help center widow-control but it does not say much. There must be setting that controls this.

Bryon

14 REPLIES 14

Widows and orphans are to control situations where lines of text are left dangling at the top or bottom of columns, eg. when the last paragraph of a line wraps over to the next page.

You mention something about characters in a row. I don't really understand what you're getting at, can you please explain?

That is what I ment to say I have quite a few situtaions where there is one word on a line.

Bryon

If you are using the APP engine, there is a property for this called fParagraph.orphanWordLength. It defaults to zero (off) but if you make it say 10 then it will not let a word of 9 characters or less appear as the final line in the paragraph.

The way APP solves the problem is to drag over the last word from the previous line so you end up with two words on the final line of the paragraph. If the final line of the paragraph has more than one word then this property has no effect (eg. even if the final line only has two very short words then that will always be allowed).

I don't know if FOSI has a similar feature.

We use Print Composer but that sounds exactly what I am looking for.

Bryon

It sounds like you are using FOSI or XSL-FO instead of the Styler/APP engine?

If you haven't tried yet, head to the Adepters forum on ptcuser.org (under Discussions->Exploders). There are some pretty knowledgable folk there who may if FOSI is able to achieve something similar.

With a FOSI of XSL-FO stylesheet, Arbortext Editor uses TeX for line-breaking. Actually, TeX builds paragraphs rather than lines. From the Wikipedia article on Tex:

"Many line breaking algorithms use a first-fit approach, where the breakpoints for each line are determined one after the other, and no breakpoint is changed after it has been chosen.[21] Such a system is not able to define a breakpoint depending on the effect that it will have on the following lines. In comparison, the total-fit line breaking algorithm used by TeX and developed by Donald Knuth and Michael Plass considers all the possible breakpoints in a paragraph, and finds the combination of line breaks that will produce the most globally pleasing arrangement."

Note that FOSI's quadding category can be set to influence line-breaking in a block of text (between two textbrks). One setting is suitable for paragraphs, the other for titles. I have attached a page from my book with examples that illustrate this.

Also, the zone characteristic on the hyphen category can be set to influence paragraph-building when output is ragged (not justified). I have attached a page from my book with an example that illustrates this.

However, multiple paragraphs whose last lines have only one word does not sound like something TeX would do. TeX is all about NOT doing that. One example is at http://www.mengensatz.de/blog/?p=89.

That blog article is quite amusing. APP/3B2 has controls for all the things the author complains about!

Given the short last line in the 3B2 example, I figured there were settings that weren't being used. The TeX supporters assumed otherwise because it was from a published document.

TeX has settings for penalties and demerits that influence line breaking, as shown in the LaTeX code and detailed in The TeXbook. Abortext's TeX engine settings could be changed in a .tmx file, if desired. However, I can't recall any FOSI formatting application that required that.

So ultimately, I need to adjust the whole paragraph in order to not have widows in a paragraph.

Bryon

If you are using FOSI, widows and orphans are handled by the keeps category. I have attached the relevant section from my book.

Generally, the widowct and orphanct characteristics on the keeps category are coded in the docdesc so they apply to the entire document. For example:

<docdesc>

<charlist>

...

<keeps orphanct="2" widowct="2">

...

Where do I find docdesc, I do not seem to have a file named that in my com.arbortext.sma folder.

Bryon

The Service Manual Application uses Styler with the APP formatting engine. FOSI is not used. You will need APP's fParagraph.orphanWordLength property which Gareth mentioned.

I believe both are used in our stylesheet. Thanks for all the information. I thought this would be a simple, go here and change this to "5" answer. But it seems I will need to do more reading to find the spot Gareth suggested.

Bryon

This property is not exposed in Styler, or wasn't last time I checked. To add that property you will want to do an "APP source edit" (sometimes called APP override). The easiest way to do that is to add a Property Set called, for example, "fixOrphanLines". You right click "fixOrphanLines" and go Edit Source.

In there you will want to add the code that is required. I don't know the incantation off the top of my head. You need to figure out what the current block object is, go to it's defaultParagraph, and set the orphanWordLength property. Something like:

formatting.currentBlock.defaultParagraph.orphanWordLength = 10;

// or perhaps

formatting.currentParagraph.orphanWordLength = 10;

You then have to associate that Property Set with all the contexts in the stylesheet you want that behaviour.

If you require more detailed assistance there are organisations that can help. The company I work for (www.gpsl.co) is an example. We are specialists in Arbortext and APP customisation, stylesheets and custom software development.

Top Tags