Conditional text in LibreOffice Writer refers to text that changes according to circumstances you set. Conditional text can both simplify the use of paragraph styles and offer a solution to one of the biggest challenges in technical documentation: how to single-source, or maintain, multiple copies of a document within the same file.
Single-sourcing files is routine in technical documentation. For example, you might want separate manuals or how-tos for average users, developers, and system administrators. Each section may use some of the same text, but go into details that are only of interest for one particular audience. Or you might want separate trainer and student guides, with trainers getting answers to quizzes and extra sections for instructions.
In such circumstances, maintaining two separate files means twice the maintenance and revision effort, and the two versions could get out of sync. As an alternative you could work from a copy of a single file, then delete passages irrelevant to the audience for which you are printing, but that is equally hit or miss. Instead, by choosing the right conditional text features, you can automate the process of single-sourcing, making it quick and reliable.
In its simplest use, conditional text makes applying paragraph styles more flexible. Instead of changing the paragraph style manually when you reach a certain circumstance, you can set up a paragraph style whose formatting changes automatically.
To set up this kind of conditional text:
The one inconvenience of creating such a paragraph style is that, if used with outline levels, it will complicate the use of features such as tables of content that rely on particular styles. However, you can work around this inconvenience by manually adding markers from which to create the table of contents, and the efficiency of the conditional style can more than compensate for the extra work, especially in short documents.
When single-sourcing, you may need to change phrases to make a passage suitable to your audience. For instance, you might want a header in a training manual to read "Advice for Trainers" in one manual and "Advice for Students" in another.
You can change phrases by setting up a conditional text field:
To change the condition, click on text with the shading that indicates a field to open the dialogue window. Use the arrow keys in the window to move to the next conditional text field.
If you need more than two conditions, use an input list instead. An input list can contain any number of items, but when you press the Insert button, LibreOffice uses only the top one. To choose an item to insert, use the controls in the dialogue window for the input list to move it to the top of the list.
When you prepare a particular version of a single-sourced document, you can hide all the text that is relevant to other versions. Writer can hide text phrases and whole paragraphs, and though it uses different dialogue windows for each case, the technique for hiding text phrases and paragraphs is almost identical:
To display hidden text, click on the gray shading, using Zoom if necessary. To display hidden paragraphs, click anywhere in the paragraph. In each case, the appropriate dialogue window opens, and you can change the condition field to 0. If you have used hidden text or paragraphs more than once, use the arrow keys in the dialogue window to move to other instances to change the conditions for them.
More conveniently, you can hide text by using a character or paragraph style:
Nothing in the editing window indicates that text or a paragraph is hidden using a character or paragraph style. To display all passages hidden by a particular style, unselect the Hidden box on the Font Effects tab for the style. You might want to leave a comment at the start of the document or a note in File -> Properties -> Description to remind you that the file includes hidden text snippets or paragraphs.
No matter what techniques you use, hidden text or paragraphs will not be printed unless you deliberately display it or select it for printing under File -> Print -> LibreOffice Writer or Tools -> Options -> LibreOffice Writer -> Print.
In addition to hiding phrases or paragraph, you can hide larger bodies of text by using sections. Created from Insert -> Section, sections generally consist of at least several paragraphs, but can be of any length. They can be set to be write-protected in normal documents, to be editable in read-only documents, or to be formatted differently from surrounding text when you create a multipurpose style.
More to the point, like paragraph and character styles, sections can be hidden, and you can set a condition for hiding a section from Format -> Section, which includes a list of sections, both hidden and visible, in the current document that you can check to ensure that you don't overlook any.
The varied locations and implementations of conditional text features in LibreOffice practically guarantee that the majority of users will overlook their potential. Conditional formatting badly needs an overhaul to make it more accessible, and especially to make the process consistent no matter what kind of text it is intended for. Still, even the use of conditions to change or hide text or paragraphs should be no challenge even for beginners, once they realize that they only need to use 0 for off and 1 for on.
Even in its present state, conditional text in LibreOffice is well worth trying. As a tool for single-sourcing, it has no parallels in other free or proprietary office suites.
Allowed tags: <a> link, <b> bold, <i> italics