About Arbortext Styler > Working with Elements in Your Stylesheet > Elements Overview > User Formatting Elements
User Formatting Elements
User Formatting Elements (UFE) are elements that you define in your stylesheet and insert into generated text to control the formatting of the generated text they enclose. Once created, you configure UFEs in the same way as Styler Formatting Elements (SFE), but their intended use is slightly different. An SFE is associated with one particular type of element, although Arbortext Styler might add new occurrences of the same SFE for each occurrence of the object it styles in the document. A UFE, however, is used to create a set of formatting properties that can be applied to any type of element in generated text. Note also that, while there is a finite number of SFEs configured for the stylesheet and you are not permitted to create new ones, you can create and manage as many UFEs as you wish to support the various formatting requirements for your stylesheet.
To display all the UFEs configured for your stylesheet in the Elements list, activate the View > User Formatting Elements menu option.
You can work with a UFE in exactly the same ways that you can with a regular element - create, delete, rename, and apply properties and styles. To create a new UFE, use one of the following methods:
1. In the Elements list, elect to create a new element as usual, by choosing Insert > Element. Name the element with the _ufe: namespace prefix and Arbortext Styler will recognize it as a User Formatting Element.
2. In the Generated Text Editor, choose the menu option Insert > User Formatting Element > (new) and add the name of the new UFE in the resulting New User Formatting Element dialog box. You may carry out this action either to insert the new UFE as a standalone element in generated text, or to have it wrap another element for formatting purposes. With this method you can create and insert the UFE in single process.
You cannot assign the Cross Reference, Graphic, Link or Link Target styles to a UFE. These styles work with attributes, and you cannot create attributes for UFEs. You also cannot assign the Document and Division styles to a UFE.
As with Styler Formatting Elements, you have access to all the options available to regular elements for the setting of formatting properties. The UFE displays the same formatting property categories as a regular element in the Elements list:
Text properties: see Text Category for information
Indent settings: see Indent Category for information
Spacing properties: see Spacing Category for information
Breaks: see Breaks Category for information
Generated text: see Generated Text Category for information
Property sets: see Property Sets Category for information
Footnotes: see Footnote Category for information
Side by side placement: see Side by Side Category for information
PDF tags: see PDF tags Category for information
HTML tags: see HTML tag Category for information
RTF properties: see RTF Category for information
Example: Using UFEs to Style an Index Title
This example demonstrates how to set formatting properties for the titles of indexes in your documents. Note that, while you can set general properties for the indexes created in your document via the Tools > Format Index menu option, these steps will create formatting properties that can be applied to the individual components of an index, as well as to any other element in the stylesheet as applicable.
1. In Arbortext Editor, open the file transport.xml located at Arbortext-path/samples/styler.
2. Note that the index element generates an index at the end of the document. The index is in three column format, and the index title is displayed across all three columns. This procedure creates a UFE that will format the index title to appear only in the first column of the index. Note that once the UFE has been created you can use it to apply the same formatting to any other element in generated text, where formatting of this type is applicable.
3. 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.
4. In the Elements list, highlight the index everywhere context and select Print/PDF from the Outputs to edit list.
5. Navigate to the Generated text category for the context and you will see in the Before-text and After-text fields that the context is set to generate an index with a title. The formatting properties for the index heading in Print/PDF output are contained in the UFEs ufe:one-column and _ufe:toc-heading-spacing, as shown in the Before-text field. The formatting properties for the index itself are defined in the index element, as shown in the After-text field.
6. Click the Edit button next to the Before-text field. The Generated Text Editor opens, displaying the formatting properties for the index heading:
This is an image of Generated Text Editor for the index element, displaying the markup <_ufe:one-column><font>INDEX</font><Rule/><_ufe:toc-heading-spacing> </_ufe:toc-heading-spacing></_ufe:one-column>
7. Highlight the _ufe:one-column element and choose Edit > Delete Markup. The _ufe:one-column element is removed, leaving the index title, and the rule and spacing settings.
8. Highlight the remaining markup and choose Insert > User Formatting Element > (new). The New User Formatting Element dialog box opens.
9. Add the name of the new UFE into the Name field, for example three-column. Note that you do not need to include the namespace prefix in this field, Arbortext Styler will add this automatically.
10. Click OK to exit the dialog box - you will see that the markup you highlighted is wrapped in the new tag _ufe:three-column. If you have activated the Options > Highlight Unstyled Elements menu option, the new tags will be shown in pink as you have not yet applied a style to the UFE.
11. In the Elements list, select the new UFE. Note that you may need to activate the View > User Formatting Elements menu option to make UFEs visible in the list.
12. Give the element a Block style via the Edit > Style menu option.
13. In the Breaks category for the element, set the value of the Columns option in the Print/PDF and RTF only field to 3.
14. Choose Print > Preview. In the Print Preview window, refer to the index at the end of the document and note that, whilst the index is in three column format, the index's title only appears in the first column of the index.