How does custom style renaming (and duplication) affect pre-existing documents?

I created an entire hierarchy of custom paragraph styles for a book.

In the template ott file, I renamed all of the styles in this hierarchy.

I opened up a chapter of the book, and pressed “update styles” in the popup box. In the paragraph styles side-bar, I found the hierarchy of styles was not renamed, but duplicated. One with the old names, corresponding to the style applied in the document, and another with the new names, not applied.

I reopened the ott template, and only the new hierarchy is present, meaning I have lost control of the styles used in all of my book chapters. I need to regain this control (i.e., be able to edit styles from ott so they affect all), and I would like to prevent this from happening again.

(I should mention also, that earlier I duplicated the ott template, as a backup for this. I then renamed the original ott, and found that automatically duplicated the original. This caused confusion, but I managed to rid My Templates of the duplicates and get back to where I started. I think.)

(Before all this, I was already frustrated with the lack of information in the Writer’s Guide on custom style duplication, which is a feature I need and am unsure how to do in a safe way.)

Templates are used to populate dependent document style dictionary. In essence, the template style directory is copied into the document. After that, the document is used as usual, referencing its local style dictionary.

When you modify style properties in a template (without changing the name), the document detects that something is different in the template at open time and asks if changes should be forwarded. The feature is based on names. Modified styles with same names will be updated. New styles (not already present in the document) are added to the dictionary.

You renamed your styles. These are considered new styles. The names don’t conflict with those in the document dictionary and they are “simply” added to it. Writer has absolutely no means to guess that style B is now the new version of style A. You have then both styles A and B.

The feature works as intended. You can base your document on a template and create new custom styles in your document (without transferring them back into the template). These document-only styles must not be erased when the template updates the style dictionary otherwise some text becomes orphaned and its styling is lost.

Applying some versioning on your template is good practice. However, changing the name of the styles will inevitably result in a mess (you experience this). Unfortunately, there is no easy way out. If your renamed styles have not yet been applied to text, just delete them from the document. Amend your template to rename the styles as they were beforehand. But be very cautious and meticulous lest you worsen the mess.

Now the fundamental question is: why do you want to rename your styles? I mean, is there a mnemonic meaning to the name? Would you prefer a better name, closer matching the purpose? The procedure is quite tricky when you have already many documents based on the template.

2 Likes

I think I understood everything. So “updating styles” of a document will add new styles from the template, and modify styles whose names are shared in the document and the template. But updating styles will not subtract styles which exist in the local document but not template, correct?


To save time, and avoid mistyping a style name, I will open a chapter/document which uses the template X (where I renamed the styles), and ensure I do not update the styles. I will save it as a new template Y. I will then delete template X, and change the name of template Y to the same as what template X was called. Do you see any issues with this?

Now the fundamental question is: why do you want to rename your styles?

My reasoning for renaming styles, was because I wanted to duplicate the custom style hierarchy, and renaming was one step in the process. I wanted to do this, because I realized I will need to decrease the font size and indentation of all styles in such hierarchy, when formatting the book to be print-ready, as opposed to big page PDF. But I want to hold onto both print and PDF versions/styles. The steps for this duplication process are as follows:

  1. Rename styles to indicate they match the PDF version and save changes in ott.
  2. Duplicate ott.
  3. Rename styles in original ott to indicate they suit the print version, and change font size and indentation accordingly.
  4. Load styles from the template copy.
  5. Now both hierarchies are in the same template. Delete template copy.
  6. I would then the top of each hierarchy inherit from another hierarchy, entitled “book”.

I imagine you are probably thinking why don't I just use different templates for different uses. It is because my use of Writer is quite limited, and I find the idea of juggling both templates and styles more complicated than having one template for which I change everything. I will always have all my styles ready at hand, and can easily browse thme using the side-bar hierarchical view.

Although I understand my above steps do not work because of the unfeasibility of renaming, I do still want to use one template for everything. Beside this book and personal notes (for which I don’t even need styles), this is my only use for Writer at this time in my life. It would be a lot easier, however, if it was possible to move styles around in the hierarchical view in the side-bar. But it appears there is no way to copy/paste, or duplicate, or move a style from one place in the hierarchy to another (e.g., I can’t copy a default style to my custom hierarchy. I have to start everything from scratch). I also find the default paragraph styles to be far to excessive for my use, especially considering I cannot delete most of them.
(edit: typos)

There is a simpler way to do this. In your procedure, you start from your document, i.e. you have to manage both styles and contents (though contents is never considered on style update; contents is only copied when you create a new document from the template).

You can open the template, modify the styles and directly File>Templates>Save as Template under any name.

Styles can be organised hierarchically, in an ancestor chart manner. Descendant styles inherit their attributes from their ancestor, unless this attribute is overridden. Consequently, with a smart hierarchy, you can control a whole set of styles from their common ancestors. The ultimate ancestor is Default Paragraph Style and its sole role is to define the attributes shared by all other styles. The “standard” style for the argumentation is not this style but Body Text.

You can then achieve your goal by modifying Default Paragraph Style by setting it for print or PDF. You do this before printing or exporting to PDF.

If you prefer to use two styles, I recommend installing Template Changer extension so that you can switch the template (without having to change the template name; you have one for print and one for PDF; both are clearly identified). However, you have the problem of maintaining both templates in sync regarding styles.

This problem can be solved with a more sophisticated (and advanced) approach. As soon as I am back at my office, I’ll add the link to a previous answer illustrating the principle.

If you mean “change the ancestor ot a style so that it inherits differently”, this is possible. Just drag the style name over the new ancestor. But, beware, style attributes are tri-state: set, unset and “transparent” (= inheriting). Unfortunately, the UI does not distinguish between unset and “transparent” (they display the same). It took me years to understand how to revert attributes to “transparent”. This is why, if you’re not hyper-cautious on your style handling, you’ll not achieve the expected result after changing the ancestor.

See above: Default Paragraph Style is not what you think in Writer. It only configures the defaults for all other style. It is not the default formatting style for text.


EDIT: back to my office, I can reference my notes.

Your question is somehow similar to In book publishing, how best to change the page size for a new edition?, i.e. how to issue two versions of the same document differing only in layout? My answer provides a tricky solution to this. You use a single template and a single narrative document. The variation in layout is achieved through a master document linking to the narrative. The master only overrides a few styles, only the ones involved in the “font size and indentation”.

It is advanced usage and tricky but the advantages are numerous. The template is untouched. There is a single unmodified narrative. You make no template manipulation. The masters clearly target your final product (and can have a descriptive name). All in all, once set up, this process is much more reliable because you never alternate between templates not in contents. But there is no free lunch: you must learn how to use Writer in such advanced use and accept the complexity.

Thank you. I think I will establish the two templates, and use template changer. I’m afraid of causing more of a mess with renaming my templates however. Once I download the template changer extension, and I do not mess around with the style names, am I free to alter the template names however I wish?

I found that page style does not update. I downloaded the extension, made a new template with a different page style, set it as the default for that template, and then I changed a document to that template, and the paragraph styles updated, but not the page style.
I then tried to alter the page style for the original template to see if that worked, and it didn’t. So it may not be the template changer extension. I’m not sure if everything is working properly.

I realized the new template I made with a different page style, is in fact based upon my old template, in the sense that when I edited my old template and then opened my new one, a popup appeared asking if I wanted to update the style.
This new template is an ott document. I don’t understand how this is possible? I clicked into Templates>Change Template> and I have no option to disconnect link to another template. It makes no sense.

Apologies for the quickfire responses. It’s just really confusing.