Changing font of style gives mixed up results

The font I use for text body is not supported by the printer. So I went to the styles, hit modify and changed my text body font from DejaVu to Courier New. Only about every seven words change to the Courier New. The rest remain DejaVu.

Note the before and after screen shots. The whole 160 page document is like this.

I can select the whole of the text and hit C-M, and it all decides to actually follow the font set for the style, but a lot of bad things happen as a side effect, such as italics disappearing from words, text in tables changing justification, etc.

(edited by ajlittoz to display the images inline)

If you put the cursor in a paragraph and double click on the target paragraph style, italics and other direct formating will remain. But this way you need to repeat in each paragraph by 160 pages.


Add Answer is reserved for solutions.

Press edit below your question if you want to add more information; also can comment an answer.

A better option that could help:

  • Choose menu Edit - Find & Replace….
  • While the cursor is in the Find: field, press the Format button.
  • Choose the DejaVu font.
  • While the cursor is in the Replace: field, press the Format button.
  • Choose the Courier New font.
  • Press the Replace all button.

Tested with LibreOffice 6.3.6.2 (x86); OS: Windows 6.1.

The behaviour you experience is a clear indication your document is formatted with a mixed strategy *a la * Word.

Your paragraphs have received paragraph styles which effectively allows you to change the font from a single location (the style definition). However, the formatting variants you need inside a paragraph have been done with direct formatting (like Ctrl+B for bold or Ctrl+I for italics) instead of character styles (like Strong Emphasis translated as bold or Emphasis translated as italics).

You also have stray direct formatting in “This is”, “I”, “instruct”, … There is no way to distinguish this stray direct formatting from the meaningful one like Elements of the Theory of Computation. Consequently, when you Ctrl+M to clear direct formatting, everything is wiped out. This would not happen if you had styled your sequences with character styles because these styles live in a different layer than direct formatting.

It also seems you applied direct formatting in various parts of your document over Text Body because you see justification changes, tables messed up, … Text in tables should be formatted Table Contents.

Remember styles are your friends. Define a style for each purpose (Text Body for common text, a style for comment paragraphs, a style for definition paragraphs, one for TODO paragraphs, one for citations, …). Thus when your change style attributes, they only impact the intended paragraphs. The same can be said for sequences inside paragraphs formatted by character styles.

Avoid direct formatting. Its only legitimate use is adding manual page breaks or restarting list numbering. Everything which can be done through a smartly crafted style should be applied with a style. This leaves very few things to direct formatting. Direct formatting is the main obstacle to formatting tuning through style optimisation.

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!

Avoid direct formatting.

This should be emphasized:

Avoid direct formatting

@gabix: I’ve been severely scorned several times here for discouraging people to direct-format their documents that I dare not repeat too overtly the motto “don’t direct format”. Thanks for encouraging me to continue in this direction.

Well, manual formatting is OK for a two-page letter (and I would be the first to say that building up a set of styles you may just waste your time). But for a case like this, for a 160-page document, it is a road to formatting disaster (and the given case is not the worst thing that may happen).

Agreed, unless you already have a template for your day-to-day letters, in which case it is even faster than direct formatting!

Absolutely. That’s in fact a case of mine: I must prepare documents following strict requirements to layout / formatting. Style-based approach, especially in OpenOffice fashion, is so far the best solution I’ve found.