Format is messed up when replacing text

I’m editing a long list, it is structured in lines and every lines begins with a number followed by a space, then the entry I must edit. Both the numbers AND the space are bold, the entry is normal, but when I select the text I want to replace, then begin typing or pasting in its place, the new text is bolded and I have to make it regular every time. If I select “paste unformatted text” nothing changes, it is still bold.

If I select a single word being italic and type to replace it, the new text is italic except the first letter, which is regular text.

Such things don’t happen with OnlyOffice for example.

Can I set it so the new text follows the emphasis (or lack thereof) of the text being replaced and not that of the previous characters?

More information is needed to give a definitive answer. Please mention OS name, LO version and save format.

When adding text, the formatting state in effect just left of the cursor position (or selected sequence) is used for new text.

From your terse description, I fear that you practice complete direct formatting (no styles), i.e. you do everything manually. This workflow complicates matters and makes final formatting less predictable and reliable. A small sample file would help to diagnose your problem.

Debian 12 LO v7.4.7.2, but I tried different versions, it’s not relevant to only that one

When adding text, the formatting state in effect just left of the cursor position (or selected sequence) is used for new text.

I want to change this, is it possible?

A small sample file would help to diagnose your problem.

**1 **Example text

(bold is not rendered here because of the space, but the space is bold too in the document)

Because the space is bold, the immediately following character(s) take the existing attributes, that is, the replacement becomes bold.

Do you need the space to be bold? If not then

  1. Click Edit > Find and Replace (Ctrl+H)
  2. In the Find field type a space
    1. Click Other Options to open them.
    2. Click the Format button and under Style, select Bold. OK
  3. In the Replace field enter a space
    1. Click the Format button and under Style select Regular. OK
  4. Click the Replace All button

It is simpler if you create lists using the list tools provided rather than manually numbering lines. You can make the numbering styles suit your requirements without interfering with the contents of the list.

This is an acceptable workaround for this particular case. But is there no option to ignore the style of the character on the left? I’ve been using OnlyOffice and this behavior is disabled by default, I assumed there is an option to change it in LibreOffice as well.

I see what you mean, but in this case I’m editing a list, manually switching style to bold, type the number, then switch back, then the entry would be a waste of time since I can just select the text I want to edit and start typing.

If I select a single word being italic and type to replace it, the new text is italic except the first letter, which is regular text.

This workaround doesn’t solve this other issue though.

Why manually? I presume it isn’t a proper list or you could do it in a few seconds by changing the Numbering Symbols style or applying a different character style such as Strong Emphasis.

I cannot replicate this. If I select an italicised word between two regular words, double-click to select (or select manually), and type a replacement word it is in italics.
If I select the preceding space as well as the italicised word then the replacement is italicised as normal.
If I select the italicised word and the following space then the entire replacement word is regular.
The most reliable way to select a single word is to double-click it.


If you are pasting then unless you paste as unformatted text then you are likely to bring across unwanted formatting.

Exactly, it’s not a proper list, but for the sake of understanding I called it that. I must edit this document this way.

Maybe it’s a bug from this particular version? I’m on 7.4.7.2 from the Debian repos, I tried everything like you did, the problem persists. What version are you on?

That’s what I do.

No I select the word in italics and begin typing to replace it, pasting copies the format or pasting unformatted text makes it regular.

Is it not possible to have it behave like this? It would be very convenient. Is there some hidden settings that can be changed? These seemingly small issues are turning my experience with LO Writer into a nightmare.

You could use Find and Replace to bold all the numbers at the beginning of (the selected) paragraphs

  1. In the Find field enter ^[:digit:]+
  2. In the Replace field enter $0
    1. While still in the Replace field, click the Format button and under Style select Bold
  3. Tick the box Regular Expressions
  4. If you don’t want other paragraphs beginning with numbers replaced, select the lines you do want and tick the box Current selection
  5. Click Replace All

From experimentation, if you select the following word and either bold and then unbold it, or italicise it and then regularise it, (either one works regardless of preceding empahsis) then when you start typing it will be regular text.

Use styles. Formatting is better controlled with them. It won’t change the fact that typing starts with the state in effect at cursor position, but you always know which styles (paragraph and character) are active.

You probably already know how to revert a paragraph style to “default” with Ctrl+0 (digit zero), giving Body Text. I configured Alt+0 for No Character Style in Tools>Customize for a similar effect on current character style.

Direct (manual) formatting is the cause of all evil and leads invariably to formatting hell.

I tried that, it doesn’t work. That’s why I was looking for a setting to regulate it.

Doing this removes other stuff I need in the paragraph. I just want the text match the selected word when I start typing (e.g. I select a word that is italics, I want the text to be italics, same with regular.

Makes me think your formatting is not “well-structured”. Styles are here for that.

In principle, when you select an existing sequence, formatting is kept. In case there are several formattings, the one at start prevails. If you erase selection before typing, you revert to the general case where formatting at left is activated.

Unfortunately this doesn’t work. If I select an italics word and begin typing to replace it, the first word is regular the rest is italics. If I select a regular word preceded by a bold space (a space styled as bold) what I type is bold. These things cause me a significant amount of time.

@ajlittoz @EarnestAl
I found out what the issue is with the italics words, it’s the regular space preceding them. If I style the space as italics, the first character of the newly typed word is italics too. But I can’t use the find and replace trick for this one, because I should replace preceding each italics word. How can I work around this?

Reduce a copy of your file to two paragraphs, and share here to test. Thanks.


Now I suppose that it can be a corruption of the user profile.

Yes, you can:
Find: (?<=^[:digit:])([:space:])
imagen

1 Like

Could it be a corruption of the document itself? This doesn’t happen on other documents, I requested a copy of the same document as .docx and it doesn’t happen there, only on the .odt of this document. Very weird

test.odt (6.0 KB)

This is an example with the same formatting. The word “said” is styled italics, if you double-click it to select and then start typing to replace it, the new word’s first character will be regular, the rest will be italics.

You have an awful mixture of styling and direct formatting. You tweaked your paragraph styles in a weird way: Normalny is the root for a new hierarchy: it is not a descendant of Default Paragraph Style. Is it possible you converted the document from DOCX or created it in Word? The derived style Zwykly Tekst changes the font to Courier.

You applied character style Domyślna czcionka akapitu which adds absolutely no attribute; so, you could as well remove its application.

The rest is done with direct formatting: initial number to bold, word “said” italic.

Following your procedure on original text, I get the same result as you. But after clearing direct formatting and applying Emphasis on “said”, everything is back to normal:

  • putting the cursor at left of said (space at left has no character style), typing is regular
  • selecting “said” word, replacement is italic, as dictated by character style Emphasis

Don’t mix styling and direct formatting. Getting expected, stable and reliable results with direct formatting requires super-guru expert skills, contrary to popular belief. Styles are your friends.

Yes, I know, there are no such styles in Word and M$ conditioned us into believing Word is the ultimate tool.

Delete the Normalny style, save and reopen, and the issue will be gone.
{60AD47DD-9AF6-45FC-8B03-0C467E12FD20}

{CC32D1B5-1EA5-4F74-BC55-C2B7C399D85D}