[Writer] Style that automatically bolds first sentence of a paragraph?


I want to create a style in Writer that automatically bolds the first sentence of a paragraph, in order to create a definition. It’d look something like this:

Definition, n. This is a definition of a word. It is definition-y.

Is there any way to do this automatically via a style?


I have a similar question here: back to back styles that flow?

I tried but didn’t find a way.

Usually, for glossaries the best way is to use the List Contents and List Heading styles but this way the “definition” gets in a different paragraph than the “term”. You want something more similar to a dictionary instead.

Under HTML I would try making a paragraph float, but this would be unpredictable. Besides LibreOffice doesn’t have such functionality anyway; you would need to create a frame for each “term” manually, so this is a no-go.

I tried using “Drop caps” for whole words which lets you apply an arbitrary style, but the interface forces you to use 2 or more lines. If it let you do a 1-line drop cap, you could get the desired effect, except that for words with non-breaking hyphens only the first side of the word gets dropped.

Still, even though this can’t be done automatically I recommend creating a Character Style named “Inline term” or the like, setting it to Bold and using it to manually mark your terms, so you can clear your Direct Formattings using Ctrl+M to the whole document without hurting the bold for your terms.

Unfortunately, there is no solution based purely on styles.

As @alvarezp suggested, you can play with style layers, but only 2 are available (with direct formatting as an extra layer, but it should be avoided):

  • paragraph style: applies formatting to the full paragraph, can be considered as a default for this paragraph
  • character style: overrides the formatting defined in the paragraph style

You then define some “definition” or “inline term” character style for your use case.

Although the Drop Caps idea seems appealing, I don’t think it is a viable solution (indepently from the 2-line issue):

  • either a single word can be highlighted,
  • or you manually set the number of characters to highlight

and this setting is shared by all occurrences.

You can’t do that with styles, but you can use a trick to reduce the workload if you are building a glossary or something like that (it’s no use for single definitions in the middle of your text):

Insert a two-column table, enter your list of definitions, select the left column and apply the character style Definition, then select the table, convert it to text. The boldface in the Definition character style will stick. If you use direct formatting to make the left column boldface, it will carry over to the entire text after conversion to plain text, at least that happened for me.

Use character styles, as alvarezp recommended, if you ever want to change the formatting for the items, all you have to do is change the character style settings instead of manually updating the formatting for all of your items.