Frequently asked questions - Writer

From The Document Foundation Wiki
< Faq‎ | Writer
Jump to: navigation, search
Im-jabber.svg

Note:
This tutorial assumes that you already know how to create a new paragraph style and how to modify existing styles.

How to adapt the presentation of the text depending on the outline?

You want the text to shift automatically following the outline level. Example of the expected output:


copie d'écran texte aligné sur niveaux de titre avec retraits différents
Adaptation of indents according to the outline level


It is possible to have this effect automatically using Conditional Styles. This functionality allows a single style to take on the attributes of other styles depending on the context.

For example, used in the header of a page, the Text Body style could take the attributes of the Header Style. We don’t recommend such “extreme” usage, because it can cause confusion. However, the feature is quite suitable for the automatic indentation we would like to use here.

In this example, the text will use only one conditional style (the titles use Heading 1, Heading 2, and Heading 3 respectively). The text style applied is automatically adapted to the context: when the text is in “level 2,” a predefined layout in another style is applied. The same applies for level 3, etc.

This is very handy, because you don’t have to bother with the layout when entering text. You choose the “conditional” style and, when you apply the titles (i.e. the Headings), the layout adapts by itself. We can achieve this in three steps.

Step one: create two ordinary, indented paragraph styles

To follow the above example, you need to create two styles which are “ordinary,” paragraph styles with only an indent defined before the text:

  • create two new ordinary, body text styles and call them Text Level 2 and Text Level 3 (chose any names that you like);
  • when you are creating Text Level 2, set its Before text Indent under Indents & Spacing tab to 0.5"; and
  • when you are creating Text Level 3, set its Before text indentation to 1.0".

These two styles are not directly applied in the document.

Step two: create two conditional paragraph styles

Now we create the conditional paragraph styles (e.g. After Heading 2 and After Heading 3) following these steps:

  • in the Styles & Formatting panel (View ▸ Styles ▸ Styles & Formatting or press F11), right-click on the Text Body paragraph-style, then chose New;
  • under the Organizer tab, give a name to the style (e.g. After Heading 2);
  • under the Condition tab, check Conditional Style;
  • in the Context list, select 2nd Outline Level, in the Paragraph Styles chose Text Level 2;
  • click on Apply and then OK; and
  • repeat the previous step for the third level with the style Text Level 3.


copie d'écran dialogue création style, onglet Condition
Creation of a conditional style

Step three: modify the heading styles

Now that you have two conditional paragraph styles ready, you have to modify the Heading 2 and Heading 3 of the heading styles as follows:

  • in the list of the applied styles in Styles and Formatting sidebar, right-click on Heading 2;
  • click on the Organizer tab;
  • under the Style section, click on the Next style dropdown menu and choose After Heading 2;
  • click OK; and
  • repeat it for the Heading 3 style (but choose After Heading 3 this time).


Im-jabber.svg

Note:

  • the Condition tab is only available during the style creation; and
  • when changing the level of a heading in the text (for example, you move the paragraph from Heading 1 to Heading 2, the context is not updated automatically and the conditional style is not automatically adapted. Two solutions:
    1. reapply the style by double clicking on the Style window; or
    2. if there are several paragraphs involved, use the Edit ▸ Search & Replace menu, click on More Options and check Search for styles, in the Search for and Replace with lists, select the conditional style name and click on Replace all.
  • Download an example document.