Proper and clean use of document templates and formatting styles

Version: 7.4.7.2 / LibreOffice Community
Build ID: 40(Build:2)
CPU threads: 2; OS: Linux 6.1; UI render: default; VCL: gtk3
Locale: en-US (en_US.utf8); UI: en-US
7.4.7-5
Calc: threaded

No document affected. Just trying to get understanding of proper templates and styles use - yet before my next writing task will start.

I like to pick up statement made once in one of my threats:

You must first think over the semantic architecture of your document. In my highly complex technical documents, I use ~15 paragraph styles (including 4 Heading n ), ~15 character styles, 2 list styles, ~5 frame styles. The number of page styles can grow rather high depending on how many “parts” you have in the document. I use a technique involving 3 pages styles per “part”.
source: Chapter X suddenly stops to print page number value in page number field - #11 by ajlittoz

My own preference is to create and maintain document structure directly in document being written > hence don’t have the feeling to need document template. There is however one point where I may need to use document template: it is creation, maintenance of formatting styles (paragraph formatting, list formatting, others) and sharing those among all documents of same kind being edited at same time.

I have now time of few weeks to acquire bit more understanding in fundamentals, those which subsequently will help to make formatting job more productive (previous writing was far from this goal).
I learned either in far past (use of MS Word) as well as in near past (previous writing using LO Writer) that proper and consequent use of formatting styles is very first measure to achieve satisfying productivity on conducting document’s formatting.

  1. No hint was found in Writer 7.4 Help if modifications of Writer stock paragraph styles get stored to current document locally only, or if it is stored globally for all documents edited subsequently.

  2. “Load Styles” function was found but no its pendant to export style to template or other document in order to share style modifications between documents.

LO Writer pre-installs vast set of formatting styles. For beginner it is hard to see the purpose of every particular pre-installed style. Also interaction between style classes (types) may be overwhelming.
Thus my idea was to use one blank document as playground in order to learn how Writer is using those styles. Unfortunately it turns out out of all those style Writer is using by default no other than Default Paragraph Style. Same applies to unordered lists and numbered lists made by automatic function (see Writer 7.4 Help > Automatic Functions > Creating Numbered or Bullet Lists as You Type).

  1. This is a problem because me never wants to create styles from scratch. Rather the preference is to take nearest Writer stock-style, conduct wanted modifications and use modified style (eventually save it under new style name, optionally share modified version with other documents). I like to rather to refrain from modifying Default Paragraph style.

Above are three thirst points which arise on my trial to get familiarized with proper template and formatting styles usage.

It is worthwhile reading the chapter on Styles in the Writer Guide and, maybe for more in depth, you could look at Designing with LibreOffice, both download from English documentation | LibreOffice Documentation - LibreOffice User Guides

It is a bit confusing with Writer beginning with Default Paragraph Style which shouldn’t be used in the document at all. It helps to use the in-built shortcuts Ctrl+0 for Text Body, Ctrl+1 for Heading 1, Ctrl+2 for heading 2. Once you have started the first words with a style it is easier.

1 Like

Writer Help is procedures-centric. It addresses at some extent the question of implemented concepts, but it makes this in highly fragmented way. It is hard to get from Help to overall picture regarding rules, concepts and best practices. Frequently it doesn’t address detailed questions.

That is why I suggested the Writer Guide and maybe Designing with LibreOffice from link above which has not yet been followed

Next problem I like to have resolved is keeping the list of defined styles short.
All styles provided by Write stock template is lengthy, especially when series like Text Body get unfolded.
Paragraph Styles View sidebar makes crazy jumps across whole view while user is reviewing or modifying styles, which is highly annoying because the decrease in productivity is large.

To resolve it the idea is to create dedicated template for each type of document part: TOC, indicies, appendices, mandatory attachements. Particular template would house only styles common for all templates and styles specific for given writing part.

Once you have defined your styles in the template, or have used a portion of available styles in your document, you can set the view to Applied Styles in the filter at the bottom of the Styles pane to see only the used styles.

I assume that by “thirst points” you mean points where you need information/advice. So, as far as my knowledge/experience goes …

  1. Modification of styles only take effect on the document/template you are currently working on, and future documents based on that document/template. Writer does not maintain a set of “normal” templates on master/group/personal levels (like MS Word does), so you will not be asked about updating the base style and your changes will not automatically propagate to past documents.

  2. There is no easy way that I see to make a style modification propagate to a set of existing documents. You may achieve something to that effect by the use of master documents, which requires some discipline and practice.

  3. All other paragraph styles descend from the “Default paragraph” style, so if you want to make changes affecting all your styles, it makes sense to modify that style. Other than that, your approach seems to be a wise one, to create/modify styles as needed. Note that when you utilize the hierarchical style system, no content should be using that “root” style.

Also, there is the set of “base fonts” in Tools - Options - LibreOffice Writer - Base fonts. Those make a starting point for a few of the predefined/builtin styles, overriding the “font inheritance” from parent style. Sometimes confusing when you don’t know about it.

Not sure whether my points above are answers to your issues. If not, post again to clarify what you meant.

For every existing document yet at every state of its maturating it seems to be possible to save document as template: Writer Help > Templates and Styles > Creating and Changing Default and Custom Templates > Creating a Custom Template
On another side Writer offer Load Styles.
Both altogether seem to make distribution of style modifications among multiple documents possible.
The only level of complication I see is number of documents to receive style modification done in source document. The more documents need to receive modification the higher effort to distribute modification.

EDIT If style modifications among multiple existing documents (those under ongoing edition) is concerned even saving style distribution source as template is not necessary as style distribution target documents can load modified styles from source directly. That one factor of complication keeps to exist:
the higher number of targets the higher the distribution efforts. I don’t see further complication factors.

This is precisely the primary purpose of templates.

Point 1. built-in styles:
Those are offered as a starting point or demonstration samples of what can be done with styles. However, some of them are already hard-wired to special features, e.g. Heading n are associated with the TOC engine and Text Body is the default style for main text; Footnote and Endnote are default for footnotes and endnotes; others are related to tables, TOC and indexes.

They are not “sacred” in any way. Feel free to customise to your state. It is even very wise to do so because their names (which suggest their usage) get translated if you share your document in some international collaboration on your colleague’s computer, which is not the case for new user styles.

Built-in styles are technically stored in the factory default template. They are used to initialise the style dictionary when you create a new document. Thereafter, any modification is kept in the user document. The template is unaffected.

Point 2. Load styles
Load Styles loads into the document style dictionary styles defined in some other document. This proceeds by copying without “linking” the “source” to your current document. Any later style modification in the “source” has no effect on the document unless you choose to explicitly load styles again.

There is no “inverse function” to Load Styles because you can load from the “export destination” document.

Managing templates is a bit different from writing a standard document. Though designing a template (which, in its simplest form is a blank document – I don’t write empty – defining styles) is similar to writing a standard document, recording it is done with File>Templates>Save as Template so that it gets the right extension and the correct internal encoding. This command is most important for template revision because opening a template usually creates a standard document and File>Save or File>Save as would save the standard document instead of updating the template.

File>Templates has other commands to manage your templates and eventually have one of yours become your default template. However be cautious because making your templates known to Writer will move them into the “system” user directory which is usually hidden, making difficult to maintain easily your templates. I prefer to create a copy before managing my templates: they are easily accessed (and versioned) in my ~/Templates directory and a selected copy is sent to the “system” directory by the management function.

Point 3. style collection
Starting from scratch is an overwhelming task, notably because you need to reconnect some styles to various “engines”, such as TOC/outline handling, footnote, URL recognition, …

As you have found out, it is simpler to customise the existing collection. I recommend that you enable the hierarchical view in the list sidepane. You’ll then explicitly see the relations (inheritance) between the various built-in styles and avoid some common pitfalls where a seemingly innocuous change affects many (children) styles.You’ll discover several “intermediate root” styles controlling a whole subtree (e.g. Heading for all Heading n or Text Body for all “discourse” styles).

In particular, Default Paragraph Style is the ancestor of all styles. This is a good location to set your preferred “universal” defaults.

Nice feature
There are two ways to use templates:

  • double-click on a template icon => you create a new document but you lose the relation with the template; later modification to the template will not be forwarded to the document
  • File>New>Templates => creates a new document from one of the templates known to Writer and keeps the link to it; later modification to the template will be forwarded to the document (if you agree)

Subtle bonus trick
As already mentioned, style modifications remain local to the document into which they are done (standard document or template, with the possibility to be forwarded to documents based on it). There is normally no interaction between global settings and your modifications.

“Global” settings are controlled by Tools>Options. What you change here will be stored in your user profile and will be taken into account before template/document configuration.

In a very sophisticated approach, you can design “semi-open” templates. Your template will define everything except what is configured by Tools>Options>LibreOffice Writer>Basic Fonts (xxx). If over time you change your aesthetic preferences about fonts, you can reconfigure them here without the need to review all your templates. Of course, this works only if you don’t override the font face and size somewhere in the style tree.

before template/document configuration does it possibly mean “Global” settings to be taken instead of format specification in template/document, rather then sequence of processing in time (first look at globals, if those available take those, subsequently take a look at template/document formatting if available take these and override the previous choice)?
I still lack whole understanding of which function the global font setting may have.
The one possible purpose I can see is: for text blocks of those few kinds ensure there is always valid font specification - if template and document miss to specify font for any of those five classes of text blocks the global settings jump in / act as joker.

Is this a real hard-wiring (means, fixed in some way in Writer binaries) rather than specifying these association in Writer’s vendor configuration?

Look at all the “Heading” styles for instance. They are hard wired to the document outline shown in the document navigator. Any heading not formatted with a “Heading” style won’t be recognized as a heading. From the headings any table of content is generated. In combination with list styles you get consistent enumerations of chapters. Many other styles are automatically used for bibliographic entries, table cells, table headers etc.
Using the styles is more important than the actual look. At any time you can modify any property of any element in one go. For instance you can change the font, spacing, underlining etc. for all level 3 headings by modifying the style “Heading 3”, no matter how many of them occur in your large document.

1 Like

You’re right, thanks. I got it, it is chaining of Load Styles, document/template by next document/template.

This is quite close to it. Writer has a “layered” way of considering your settings, a bit like using tracing paper in technical drawing: you can see lower layers but the graphics on this layer hide those below.

The precedence in Writer are, from lowest to highest:

  • globals
  • template import (only once when derived document is created or at update time)
  • document overrides

And between styles:

  • paragraph
  • character
  • internet link (only case I know where 2 character styles can be applied)
  • direct formatting

There is some subtlety with paragraph direct formatting and character direct formatting but it is not necessary to take this into account to understand Writer behaviour.

Not really “hard” because you can change it at will. However the out-of-the-shelf configuration already offers you something usable. But changing it requires to know what you’re doing because you must customise several sets of settings. @Villeroy already gave you an idea about the heading feature.

One common request is to number numerically chapters and alphabetically annexes. This requires to build a parallel hierarchy of alpha-headings linking them to a separate list style and attaching them to outline levels. Not difficult when you know the trick but you have to understand a lot of concepts to succeed.

Thanks.
Which mistakes does one need to be aware of and are to be avoided if master and sub-documents are used for one writing work and the only purpose is to merge all publication parts into one single document to add e.g. front page/sections, TOC, indicies, etc? It means writing won’t be published in multiple different forms and formatting.
(i) Styles in use distributed evenly to master and all sub-documents, (ii) only those styles to use which are known for master and all sub-documents, (iii) any further rules?

EDIT
I forgot to mention the goal is: each sub-document to have one single look regardless of it is being viewed through master or stand-alone. In this particular case master’s purpose is not to modify the look. Instead just merging multiple into one.

When the master is “assembled” for final publication, the styles in the master have precedence. If one style doesn’t exist in the master, the onse in the sub-document is used.

The best approach is to base all documents on the same template so that they are all consistent. Just refrain to modify styles in a sub-doc because this won’t propagate to the master (if there is one with the same name). Change styles in the template and reopen the needing document.
Notice it is not immediate to create a master from a template. You’ll need the Template Changer extension to force a template on a master.

This does not preclude some fancy procedure. I once intentionally forced a different version of a paragraph style in sub-docs to make the job easier. The final paragraph style was hidden and very small font size so that it won’t occupy space in print. But modifying content was not easy in the sub-docs. So its font size was different there.
But if you go for such acrobatics, you better know what’s you’re doing and have a good expertise at styles and master /sub-docs interactions.

That is interesting relation character style to paragraph style. One could expect paragraph style to use reference to existing character style instead of carrying built-in character formatting specification. Current implementation must have its advantages.

There is some “hard-wiring” in the code - e.g., in mapping between Word’s and Writer’s styles, used on import. However, it’s not that much; e.g., the Heading styles mentioned above are just having some default settings in a new default document: Heading 1 is tied to Chapter Numbering's level 1, and that way, it has respective outline level, which puts it into many things like Navigator, ToC, fields, etc.
But this association of Heading 1 to Chapter Numbering’s first level is configurable.
So mostly there’s “specifying these association in Writer’s vendor configuration”, or something like that.

This defines default character properties for a paragraph style, avoiding the pain to systematically define/create a character style. You have a more compact definition without the risk of forgetting it.

Character styles allow unlimited nesting. Unfortunately, a real UI for that is missing (tdf#115311). The current way to apply several character styles:

  1. Apply the first style normally.
  2. Single-click on another style you want to also apply (in Style Manager F11).
  3. Hold Shift and double-click this other style.

The result will have properties of both styles (last wins for conflicting properties), and modifications to any of them would reflect on the text.

1 Like