About Arbortext Styler > Working with Elements in Your Stylesheet > Keeping Elements Together
  
Keeping Elements Together
Arbortext Styler provides the ability to keep elements, as well as element content, together across line, page, and column boundaries. This is referred to as keeps. You can specify a priority level for a keeps rule, from 1 (lowest) to 7 (highest), to indicate to Arbortext Styler whether or not it should keep the elements together when a line, column, or page break occurs.
If Arbortext Styler cannot honor keep settings for a block of elements on a line, page, or column, then it discards all keeps rules with a 1 priority level, and then determines new break points. If Arbortext Styler cannot determine a break after discarding 1 priority level keeps, it discards all priority level 2 keeps. Arbortext Styler continues to evaluate and discard priority level keep-together rules until it finds an acceptable break point.
* 
We recommend that you apply a priority level to a child element that is higher than the priority level of its parent element. This allows Arbortext Styler to apply a keeps rule to the child element if it discards the keep on the parent element.
Arbortext Styler is more likely to ignore low- to medium-range priority levels (1-4) than those in the high range (5-6) if there is an overset. An element context with a keeps priority level 7 never breaks.
Keep Elements Together
1. In the Elements list in Arbortext Styler, select the element context to which you want to apply a keeps rule.
2. Expand the Breaks category. Go to the Keeps sub-category.
3. In the Keep scope field, specify a scope for the keep-together rule. There are three options:
in same column: element must not break across columns or pages
on same page: element can break across columns but not across pages
on same line: element must remain on one line
4. Select a value from one of the other three other drop down lists in the Keep properties group. The value you select here will both assign a type of keep and the strictness of the keep rule.
Keep content together: any content within the element will always be displayed as a single block, without breaking onto the next page, even if the whole element has to be started on a new page.
Keep with next element: the selected element and the element that succeeds it in the document will never be separated by a line, page or column break.
Keep with previous element: the selected element and the element that precedes it in the document will never be separated by a line, page or column break.
Arbortext Styler is more likely to ignore low to medium range priority levels (1-4) than those in the high range (5-6) if there is an overset. An element context with a 7 priority level keep-together rule will never break.
5. Click OK to save the change and exit the dialog box.
Widow and Orphan Control
You can specify when to keep elements together at the top or bottom of a page or column. An orphan is the first line of a paragraph left at the bottom of a page or column when the rest of the paragraph starts in the next page or column. A widow is the last line of a paragraph carried over to the top of a page or column when the rest of the paragraph fits into the previous page or column. Arbortext Styler lets you specify the minimum number of lines to display at the top and bottom of pages or columns, so that widows and orphans do not occur.
1. In the Elements list in Arbortext Styler, select the element context for which you want to control widows or orphans.
2. Expand the Breaks category. Go to the Keeps sub-category.
3. In the Widow and orphan control (print/PDF and RTF only) field, choose one of the following settings from the Number of lines to keep at top of page or column list to control widows:
<Derive> - Obtains the value from a property set, context, ancestor, or default.
Any number - Does not prevent page or column breaks between lines of the element's content. Widow lines are permitted.
2 or more - Specifies that no less than two lines of the element's content can display at the top of a page or column.
3 or more - Specifies that no less than three lines of the element's content can display at the top of a page or column.
4. Choose one of the following settings from the Number of lines to keep at bottom of page or column list to control orphans:
<Derive> - Obtains the value from a property set, context, ancestor, or default.
Any number - Does not prevent page or column breaks between lines of the element's content. Orphan lines are permitted.
2 or more - Specifies that a page or column break can only occur after two or more lines of the element's content.
3 or more - Specifies that a page or column break can only occur after three or more lines of the element's content.
If a page or column break occurs in the middle of a table, each table row is considered as a line. When you make settings in the Number of lines to keep at top of page or column or Number of lines to keep at bottom of page or column fields in the context of table these define the number of table rows to control. Widow and orphan control will work correctly within a table that breaks over pages.
If the Structure type field in the Breaks category has been set to Inline for an element, the only Keep value to have any effect for that element is Keep content together. It should also be noted that this setting will only have an effect if the Keep scope field is set to on same line.
Run-In Titles
Arbortext Styler provides the ability for you to create a title that starts a new line but that runs immediately into the element that follows it, rather than appearing as a separate block. For example, you may wish to create a run-in title that is grouped with the paragraph that follows it in the document, and have the title displayed at the beginning of the paragraph, rather than above it, as shown below:
This feature is not supported for property sets.
Example of Block Title
This is an image of a title placed above the following text on a separate line
Example of Run-In Title
This is an image of a title placed before the following text on the same line
Note that the display of run-in titles is only supported in FOSI output, so will only be visible in Editor view and print/PDF output published with FOSI. It should also be noted that certain elements do not permit a title to run into them, for example elements styled as Table or List.
Example: Creating Run-In Titles
Here you will set the title of a formalpara element to run directly into the first para element in the formalpara, as shown in the graphic above.
1. In Arbortext Editor, open the transport.xml document located at Arbortext-path/samples/styler.
2. Choose Styler > Edit Stylesheet to open the associated stylesheet for edit. This is a read only stylesheet so you will need to save a local copy if you want to make amendments.
3. Navigate to the first chapter in the document, and note that the second element in the chapter is a formalpara element that contains a title and a para.
4. Back in Arbortext Styler, select the title element in the Elements list.
5. Choose Insert > Context to create a new condition for the title element. The New Context dialog box opens.
6. Click the New Parent button and select formalpara from the drop down list.
7. Click OK to save the context and exit the dialog box. The new context title in formalpara appears for the title element.
8. Navigate to the Breaks category for the context and select With following from the Run-in drop down list in the FOSI only field. A message appears, reminding you to set the “Run in with preceding” option for the element into which the title should run. Click OK to exit the message (select the Do not tell me this again in this session option to turn off reminders for the current Arbortext Styler session).
9. Select the para element in the Elements list.
10. Choose Insert > Context to create a new context for the para element.
11. In the New Context dialog box, click New Parent and select formalpara from the drop down list.
12. Highlight para in the tree and select first from the Position field.
13. Click OK to save the context and exit the dialog box. The new context first para in formalpara appears for the para element.
14. With the context selected, navigate to the Breaks category for the context and select With preceding from the Run-in drop down list in the FOSI only field. A message appears, reminding you to set the “Run in with following” option for the element into which the title should run. Click OK to exit the message (select the Do not tell me this again in this session option to turn off reminders for the current Arbortext Styler session).
15. Choose Preview > Print (FOSI). In the Print Preview window that appears, note the new appearance of the formalpara in the first chapter of the sample document. The title of the formalpara now runs directly into the first paragraph.