LibreOffice may seem like just another word processor, but looks can deceive. A case in point is the ability to single-source, using features that go under the deceptively simple description of Hide.
Single-sourcing is the maintenance of multiple versions of a document within the same file. For example, you might three versions of a software manual: one for admins, one for programmers, and one for users. You could maintain each version in a separate file, but unless you are unusually conscientious, over time the versions are likely to fall out of sync. Similarly, without Writer’s tools, if trying to maintain the different versions in one file, you would have to delete irrelevant sections when printing each version, which would greatly increase the chances of error — and, unless you are careful to keep current backups, the risk of losing information by saving afterwards without restoring the temporary deletions.
By contrast, using Writer’s single-sourcing tools removes all these hazards without requiring the use of Git or another versioning tool. Writer offers three ways to single-source, using fields sections, and styles.
Single-sourcing with fields and sections
Sometimes, the difference between versions will be slight, another title, or a few references or short paragraphs. In such cases, you can maintain two versions with three items found in Insert | Field | More Fields | Function: Hidden Text, Hidden Paragraph, and Conditional Text.
With Hidden Text and Hidden Paragraph, each of these fields has two conditions — on or off. For ,instance when the condition is set to 0, the contents of the field is hidden, giving one version of the file. Then, when a condition is set to 1, the content is shown, giving a second version. To simplify matters, the condition that turns on one version of a document could be the name of the version, such as Admin Guide.
Conditional text works a bit differently, using three fields. For example, if the condition is 1, then the document displays the text entered in the Then field. Change the condition to anything else, and the document displays the text entered in the Else field.
Sections are passages that have a different format from the rest of the text. They can be set to Hide when a condition is set to 0, and to display when the condition is set to 1. Alternatively, a section can be linked so that it displays another file’s contents. Change the link in the File name field, and the section can display another file. Using sections to single-source is convenient when the differences between versions are longer than the short phrases usually used with fields.
Single-sourcing with fields and sections can be difficult. Some users find the idea of conditions confusing. Fields in particular have few characters visible, which can make identifying a paragraph of any length difficult. However, the greatest problem in working with fields and sections is that conditions have to be changed individually. You can create a master-switch using Insert | Field | More Fields | Function | Variables | Set variable, but that may be more than you want to deal with. However, so long as View | Field Shadings is turned on, fields might suffice for uncomplicated single-sourcing.
Single-sourcing with styles
Using paragraph and character styles is likely the most efficient way to single-source. Styles have the advantage of replacing conditions with a check box, and, unlike with conditions, they are not simply binary, and can be easily used with more than two versions. In addition, the graphical interface makes toggling versions on and off a global event without the bother of creating a master-switch variable.
When using styles, create a different version of each style that is used in the body of the text, one for each version. For example, when maintaining multiple manuals, you could use the Text Body paragraph style to quickly clone separate styles for the unique contents called Admin Text Body, Project Manager Text Body, and User Guide Text Body. The pre-defined Text Body style can be reserved for contents that does not change. Other styles, like Text Indent and Heading 1, would have similarly named styles. Character styles have exactly the same Hidden check box.
All these styles will look exactly the same, but, at any given time, on the Fonts Effect tab, the Hidden box will be checked or unchecked on each style. Instead of searching through the document, you can open the Styles and Formatting window by pressing F11, and quickly locate the styles in the window’s list.
Using styles, you can have a number of strategies. For example, you can use the default paragraph styles for text that does not change, and toggle the other versions on and off by using the Hidden check box. Alternately, you could use only the styles created for each version, ignoring the default styles altogether. Set the Styles and Formatting window’s filter to display Custom or Applied styles, and locating the styles to toggle will be easy, provided only that you give specific names to help you navigate.
Hiding in Plain Sight
Single-sourcing is not for everyone. If you are new to the idea, you might want to figure out your needs on paper before trying to create the necessary conditions or styles. But single-sourcing is just one of the ways that LibreOffice Writer caters to the needs of professional. That Hidden check box may look like just another font effect (perhaps even an obsolete one), but when you have the need for it, there it is — a surprisingly sophisticated tool, hiding in plain sight.