We will be migrating from Ask to Discourse on the first week of August, read the details here

# Why Are Styles Not Being Applied In Master document [closed]

I have a master/sub document where styles are not being applied properly when the master is opened. I am applying the Text Body style to all of the paragraph text in the subdocument, but when the master opens, the paragraph will have portions in another style, and I cannot determine which it is or how to correct it other than retype the paragraph.

Anyone have any suggestions or ideas?

edit retag reopen merge delete

### Closed for the following reason the question is answered, right answer was accepted by Alex Kemp close date 2020-11-26 16:12:18.390591

Sort by » oldest newest most voted

When you format a document, avoid as much as you can direct formatting. All the more when several files are involved, such as template, master and subdocuments.

To understand why direct formatting is harmful, you need to understand the priority between styling elements.

• At the bottom, there are paragraph styles.
• Above them, character styles allow to override the general attributes set in the paragraph style.
• At the top, direct formatting will hide anything in the other layers.

When a sub-document is referenced by a master, formatting is performed by the styles defined in the master. Consequently, you can replace formatting (paragraph and character) by defining styles with the same name in the master. If a named style in a sub-document does not exist in the master, the sub-document definition is used.

But direct formatting has no name. As such, it can't be overridden in the master and will be used as is. Remember that to make things worse, direct formatting is in the top style layer and can't be overridden.

The method to use when you have a complex document structure (e.g. master + sub-docs, eventually with template(s)), format everything exclusively with styles. Then, changing the styles in the master has predictable and reliable effect.

To fix your problem: Format>Clear direct formatting or Ctrl+M on all problematic paragraphs. For a more definitive solution, reformat your sub-docs with character styles (or more generally styles) where needed.

To show the community your question has been answered, click the ✓ next to the correct answer, and "upvote" by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.

more

As a note, this primarily happens when I type an edit into a subdocument. When I do that, some or all of the typing I added is the text that does not accept the style being applied when the subdocument is merged into the master. It appears to be the default style applied when I create a new document. As I tried to explain, I selected the entire paragraph, or set of paragraphs, and applied a style. Everything appeared to have that style as I went through the text character by character reviewing the style for each character in the subdocument. That is why seeing sections (the new typing) having a different style did not make any sense to me. The Ctrl+M method works, and I believe this is the second time you have explained it to me. I guess my old git memory is in need of work ...(more)

( 2020-09-30 14:35:13 +0200 )edit

It doesn't work when direct formatting is present because of the precedence rule. Direct formatting always has priority over styles. This precedence order is necessary to cope with some situations. But if you use direct formatting without understanding thoroughly the implication, you'll defeat all your style organisation. Worse, direct formatting is very sticky and there is no visual feedback about it in the menus, style sidepane, status bars, …

( 2020-09-30 14:52:18 +0200 )edit

Question: If, as I did, add text in the middle of a body of text with a style applied to that body, is that text being inserted with the "direct formatting" attribute? And, what is the "direct formatting" attribute anyway?

( 2020-09-30 15:11:38 +0200 )edit

When you position your cursor in text and start typing, your addition inherit all styling in effect at immediate left of the starting position. Of course, you keep the current paragraph style because it is always present (be it Default Style) and the character style if any. But, also, the direct formatting you might have applied to the character before the insertion point. This is where it becomes malicious because you have no indication that this DF exists.

Direct formatting is any "embellishment" you apply outside styles: a mouse click on a toolbar button (for bold, italic, list numbering, …), a keyboard shortcut (Ctrl+B for bold, …), a command from a menu (Format>Text>… and the like), a "property" applied from the sidepane.

Sometimes, the aspect of a button may change in the toolbar (e.g. the B button), but frequently you have no visual feedback or the change ...(more)

( 2020-09-30 16:05:27 +0200 )edit

Styles in master have a priority over subdocument styles, therefore you see that behavior. Just add styles from subdocuments to master document with replacement

more

The Text Body style is one of the default styles. It appears in both and is what is applied in the subdocument and what should be applied in the master. However parts of the paragraph are getting a random style applied.

Trying to make more clear. A paragraph in the subdocument has the Text Body style applied to the entire paragraph. When the master is opened, parts of that paragraph have multiple styles, while still showing Text Body in the bar at the top throughout the paragraph.

( 2020-09-30 02:33:06 +0200 )edit
1

This probably means that the paragraph is blotted with direct formatting.

What happens in the sub-document if you select the paragraph and Ctrl+M (clear direct formatting)?

( 2020-09-30 08:07:52 +0200 )edit

ajlittoz has indicated the solution to the problem. Applying CTRL+M to the affected text in the subdocument clears the problem from the compiled master document. Thank you.

more