How do I highlight around the text, rather than the text itself?

Hello, I’m pretty new to LO Writer, and I was trying to make a template for notes. I wanted to make this heading style where there is highlighting around the heading (so like horizontal colored lines going out of the heading), I don’t want to do this by using shapes, because that would become too tedious. It would also be pretty cool if the highlighting adjusts with the justification of the text, so if the text is aligned to the left, only the right side is highlighted. Is this possible in LO Writer, if so what should I do in order to do it? Any sort of help is appreciated.

EDIT by ajlittoz (because can’t add images to comments)

Does this look like the “embellishment” you want?

What about Borders on the paragraph style? Could you please provide a screenshot, how you expect that to look like?

You can do some of this by adding borders or a paragraph background (color or graphic) to the Heading 1 paragraph style. It really depends on how elaborate you want the embellishment to be.

@ajlittoz: a hint: you can prepare the image in an answer, then cut and paste into the comment :slight_smile:

1 Like

@anon73440385 https://i.imgur.com/4PWBVZu.png . Here is what I want it to look like, however I achieved this through adding spaces before and after the heading and highlighting those spaces. Is there any way to make this way easier to do?

@chrismg12: I’ve tried to emulate your effect with left and right borders, but: 1) borders have a maximum width of 9pt, 2) borders are set on the paragraph limits, i.e. left and right margins, not on text limits.

Your solution seems to be the only option if you don’t want the colour stripes to extend to margins. Have you considered entering the sequence as an AutoText?

@mikekaganski: before resolving to edit the question, I entered manually the ![…](…) code for image insertion biut it didn’t show. I then copied the same code from an answer and it didn’t work either. Maybe this is an AskBot limitation. I haven’t tried direct image pasting.

To achieve what you requested, you can use a combination of a paragraph style and a character style.

Attached document has a heading 1 style with centered text and red background, and the BlackOnWhite character style with white text background. You have to apply both to your heading. For the next paragraph, the Text body paragraph style will apply automatically, but you may need to apply the Default character style manually.

And Mike’s solution is even better (see his comments below). No need for the text style. Highlighting also overlays paragraph background. For some reason I couldn’t make that work, but it must be my mistake. It works fine now. Thanks @Mike-Kaganski

But paragraph style also allows to define character properties, including text color and highlighting, too - wouldn’t that eliminate the need of additional character style?

The paragraph background goes from left to right margin, while text background only extends as far as the text. This is used in my suggestion to make the background mimick the image linked by the OP.

Text background overlays paragraph background so the text appears on white while the rest of the heading line shows the red paragraph background.

I can’t find any better way to solve this. There are other ways, but they generally require more work and introduce more clutter.

Here’s your sample, with character style replaced with paragraph style’s highlighting settings.

Thanks @Mike-Kaganski! I couldn’t make that work. Works fine now.

Probably some direct formatting that got in my way, or some other silly mistake. I make those.

Hi,

I don’t know if something changed in the last four years, but both solutions produce a few ugly pixels (see attachment)

@theoware: since the question is already 4 years old, ask your own. Name your OS, LO version and save format.
Describe explicitly and accurately the result you want to achieve. Attach a sample file and tell what’s wrong in your present implementation. Remember that a screenshot is of little help because 1) you didn’t mention what you want, 2) a screenshot does not expose the formatting.

Wow, really didn’t expect an answer this quick. Thanks for the advice. I’ve created a new issue.