Can't update style: line spacing

I just managed to replicate the problem with a brand new paragraph, in the same document. I created a new style, Text Body Bold, which is the same as the text body just bold, as you suggested. So I just typed random things. I tried to apply modifications to the style, and everything went fine, line spacing, font size, everything worked and the style changed. AutoUpdate was unchecked. Then I just selected some of the random words and typed in other random stuff in their place, as if I was normally modifying a document. And there it was! Now if I tried changing the style, those new words were regarded as directly formatted, even if the only thing I did was simply typing them in place of other words, without changing style or anything else. But if I try this in a new document, that is, I take a completely new document, type random stuff, make modifications and then edit the stlye, it works. So the problem is with my current document and I don’t know why.

I tried something else: I selected the entire text of the experiment document I attached, I cleared all direct formatting. I expect things to be normal now. They weren’t. Again, if I type new words in place of others LibreOffice regards them as directly formatted. And then I managed to replicate the problem in the brand new document too. All I did was waiting some minutes, then adding a line of text in the style Heading 1, and then I just modified some words at random in random paragraphs and boom, the style Text Body could not properly update anymore. Note that in this new document I didn’t apply any type of direct formatting at all.
So no, it is NOT my original document, something I’m quite happy about, but it’s something else, something I’m desperate about.

Your sample file shows that the “aaa” paragraphs are “pure”, i.e. without direct formatting. Those with random text are plagued with DF.

When you replace words in text, what you type inherits the total formatting (styles+DF) at the position of the cursor. Thus, even if you type without adding anything, you still inherit DF in effect at the initial position of the cursor. This DF blocks any attempt to update text with style modification.

Remember, it is very difficult to get rid of DF and DF always plays tricks on your back.

Side question: has your text ever been store in Google Docs? When I open it it complains the Italian hyphenation package is missing (which is true), but usually it results from some corruption by Google Docs.

“When you replace words in text, what you type inherits the total formatting (styles+DF) at the position of the cursor. Thus, even if you type without adding anything, you still inherit DF in effect at the initial position of the cursor. This DF blocks any attempt to update text with style modification.”

Ok I think we’re onto something here. You’re saying that if I type something new in place of something typed before, then I automatically get DF on the new text, is that so? Because this is the behaviour I also thought I noticed. So how do I get rid of this? How to I make modifications and changing words without sprinkling DF all over my text? You named “default template” in the other comment, does this have something to do with DF? Because it becomes rather cumbersome if I have to select Text Body everytime I just change one word or something.

Nope no Google Docs.

I typed a DF paragraph. I put the cursor somewhere and Ctrl+M in the hope to start without DF. No luck!

To get rid of DF, I must type a character, select it and Ctrl+M. BUT, if I overwrite it, I get again DF because DF is in effect before the character I replaced. The procedure seems to be: type a char, select it to Ctrl+M, move cursor past this character and type. Now, what you type inherit from the cleared char. Of course, if this char was a dummy, you must later erase it.

Not user-friendly at all. This illustrates once again why DF should be avoided.

I was mentioning templates in case your document was template-based and you had some mis-configuration in it. Doesn’t seem to be the case.

So to summarize, you’re telling me that:

  • if I type something in order to substiute something I had typed before, I get DF, EVEN IF the text I’m typing over didn’t have any DF at all from before, and neither did the whole paragraph or the whole document for that matter?
  • and that it is a pain to try and remove DF afterwards?
    Not user friendly at all, no!

Do you know if there’s a way to highlight text pleagued by direct formatting in the document? So that I can at least see what in the world is going on?

No way presently. Upcoming 7.1 will have a “style inspector” which will show all the layers paragraph+character+DF. Meanwhile, nope.

This is indeed a bug, but it doesn’t have to do with line spacing specifically.

What happens is: when you select a portion of text, be it a word or a whole paragraph, and then directly type new text in order to substitute it, LibreOffice applies direct formatting to the new text, meaning that the new text has all the same characteristics of the old one, but they are recorded as characteristics belonging to direct formatting and to the style of the paragraph. Since direct formatting doesn’t change when you change paragraph or character style, when you try to later edit the paragraph style you’ll find that the new changes won’t apply to all the text you typed above old text. So basically you can’t update your style properly and you’ll have patches of directly formatted text all over your document if you’ve been substituing a lot of text.

There is a workaround to this that’s not too bothersome: instead of typing the new text, you first delete the old one and only then you type. So no substituting text, ever, at least until the bug is fixed.

The bug has been seen on several versions of LibreOffice, backward until at least 6.4.4.2, and in the new versions too, on Windows 10. Maybe different OS don’t have this problem but that’s unsure.

Important note: always use styles and no direct formatting. This has no effect on the bug, but I mention it because if you have to fix a document with a lot of direct formatting sprinkled in it as a result of the bug, it’s going to be much easier if you don’t have to deal with the direct formatting you put in voluntarily yourself. Example: you have a paragraph directly formatted to be centred instead than left aligned. Then you realize there’s direct formatting everywhere as a result of the bug, so the obvious thing to do to fix it is to select everything and just hit CTRL+M. Well, now the text you wanted to be centred is going to be left aligned as per style format. So using by default no direct formatting at all is going to save you time and energy, generally and even more if you have to deal with this bug.

“when you select a portion of text, be it a word or a whole paragraph, and then directly type new text in order to substitute it, LibreOffice applies direct formatting to the new text,”

I am on Mac LO 7.4.6.2. Thanks Marswriting for thoroughly investigating this bug. Version 7.4.6.2 still seems to suffer from this bug. Since OpenOffice does not open on my Mac (Mac Studio Monterey ‘developer verification problem’) I cant tell if OO does not have the same problem, as indicated above.
So can anybody confirm this LO bug still persists in September 2023?

1 Like

The bug is not in LO Writer but in user understanding of style precedence. Styles are kind of layers where higher layers mask lower layers. From deepest to shallowest:

  • paragraph style
  • character style
  • direct formatting

Direct formatting always has precedence over styles. Therefore, your P or C style is modified but the effect is hdden by direct formatting.

Regarding text insertion/replacement, deleting it before typing does not change the result. Text is given the formatting in effect at the starting point of insertion/replacement. All layers are taken into account. Consequently, this is the sum of paragraph and character styles plus direct formatting over it.

I repeat: there is no bug. This is one of the many reasons why you must avoid direct formatting. Contrary to popular belief, DF is not “intuitive” and achieving expected formatting with it requires super-expert skills. And even so, maintenance or modification of the document is a nightmare.

Thanks for trying to clarify again.

I updated to LO 7.5.7.1. and now could NOT confirm the problem described by Marswriting as “when you select a portion of text, be it a word or a whole paragraph, and then directly type new text in order to substitute it, LibreOffice applies direct formatting to the new text, meaning that the new text has all the same characteristics of the old one, but they are recorded as characteristics belonging to direct formatting”.

I can even select one word, apply bold-style for that word (I guess this counts as direct formatting) and still change font size by editing style: bold is kept, font size changed - so far so good.

Alas, I accidently found another one. Applying edited style does sometimes not seem to work following “unusual” characters such as German ‘ßäöü’. Have a look at the following picture where I changed style font size from 12 to 7:


style-edit-problem-example.odt (13.5 KB)

Hi Falko, yes the bug existed until recently I think but I have just tried to replicate it right now and I think it’s fixed. I’m using LibreOffice version 7.5.5.2, Windows, downloaded just a few days ago. Maybe try that one and see how it goes.

EDIT: posted just when you were also answering. But yes, it’s fixed then! :slight_smile: sorry about the German though

@Falko: attach your sample file to your comment (reopen it for edit and attach; no need to add another comment). I’d like to have a look at the formatting.

EDIT:
You have direct formatting on fragments of line. DF always takes precedence over styles. After selecting all text and Ctrl+M, everything is back to normal.

Remember the golden rule: don’t use direct formatting unless there is a complling reason for it. Direct formatting is the root for all evil.

@ajlittoz , that direct formatting has precedence over styles has been understood. The question is, where did DF come from.

I had copied the text piece from a larger file where I had done
1.“Clear formatting” from the styles menu - which I assume ist the same as Ctrl-M - and
2. Select-apply style
shortly before. Than I edited the style on font size and → strange behaviour.

I guess you agree that the pattern of misbehaviour is strange and difficult to explain.

Is there any way to see DF, i.e. how did you examine the file?

I use the Style Inspector in the side side pane.

How interesting.

In a 90-page manuscript I find, for one style, longer passages without any DF and other passages with tons of DF.
Puzzling.
Using the style inspector, it must be possible to investigate systematically how DFs creep in. But not now.

Now it will be my pleasure to purify my manuscripts.