How to underline Title 1 with some spacing

I want to achieve a similar effect using just Font/Paragraph properties, in the attached example I used a line object with spacing, but I’d like to have the line and spacing defined in a proper paragraph style.

95d42b151

You didn’t completely specify your request. Is this for an entire paragraph? only for one word inside a paragraph? You didn’t mention either OS name, LO version and save format.

I assume you don’t want a “simple” underlining because there is no way to tune the spacing.

Full paragraph

Open the paragraph style you’ve applied to your “title” and go to Borders tab.

  1. set the various attributes for the Line
  2. in the *User-defined sketch, click at bottom to add a bottom border
  3. untick Synchronize in Padding and set the Bottom padding distance
  4. it is probably a good idea to untick *Merge with next paragraph

To customise the distance between this bottom border, go to Indents & Spacing tab and set Spacing Below paragraph.

When customise as above, the “underline” stretches from margin to margin. This is ugly. To reduce the extent, go again to Indents & Spacing tab and set Indent Before text and After text to some value like 4 or 5 cm. This will also affect your title: its extension will also be limited to these indents (causing line wrap if title is too long).

Experiment to find the “best” values.

Single word

The principle is the same: create a character style and configure its Borders tab. However you can’t specify the distance below the border and the next line. It remains a property of the font and paragraph line spacing.

Remark

It is usually a very bad idea of using drawing objects because their position can’t be related to any text element. Therefore, when you edit your document, causing a shift in your title, the line object remains where it was set and does not follow the title.

Drawing objects are meant for “fixed” decoration and are not fit for text “argumentation”.

It is a Title 1 Paragraph with just the chapter title. Underline is not working, no spacing is possible, if I add a border the border will be the whole line, I found no way to limit it to the word part. The OS is Windows 10 64bit and LibreOffice is 7.6.4.1 the only alternative would be put an image with the text and the underline, but this may break with the index, I’m not sure and would prefer to keep things as simple as possible.

Didn’t read this part, I guess this is a good workaround but I need to fine tune the spacing for each chapter, every chapter is just one word but not the same lenght, I guess there is no other way to specify to add a border up until the work extent.

You can proceed differently. Set the indents to some arbitrary value so that the bottom border looks nice. The single-word title will be centered over this border (you requested Center alignment, didn’t you?). The border is naturally wider than the word but it’s a “decoration” not an underline.

Otherwise, don’t add a border to Heading 1 (I assume your locale is not English and you translated to the best equivalent to the name in your language). Create a character style with the bottom border. Apply this character style to the title word. Since it is a character style, the border will be exactly as wide as the word.

Character styles are often neglected because they don’t exist in Word. Also the formatting will be persistent if you save .odt and not .doc(x).

The idea was to have the underline a little shorter than the word since it is a decoration, longer than the word is nice but not the best.

You could use a typographical decoration which has more presence than just a line; the length would then be less important.

If the heading style and the decoration were combined in an AutoText entry it would be easy to insert and easy to change all by using styles.

I have attached a sample with a long title and the short title too. I cannot add it to your AutoText entries so you would have to do that.
TypographicalDecorationWithChapter.odt (16.1 KB)

You can even improve on @EarnestAl’s solution.

What he did

Chapter heading is styled Heading 1. The cul-de-lampe or fleuron is a drawing object anchored “as character” in a Decor-styled paragraph immediately below the chapter heading.

You have two paragraphs for what is logically a single unit of significance.

Improvement

Since non-text data is discarded from TOC collection, the cul-de-lampe can be inserted directly into the Heading 1 to leave the single “logical” heading paragraph. The sequence is: heading, line break Shift+Enter, cul-de-lampe.

If you want to be able to change the vertical spacing between the heading and the cul-de-lampe, you have two possibilities:

  • play with Heading 1 line spacing
    Correct only if your heading is limited to a single line
  • add one space before the cul-de-lampe and one after (for symmetry) and apply a specific character style to force font size
    This works because blank lines (cul-de-lampe is a drawing object not a character) are removed before being collected into the TOC (this is probably an unintentional by-product of an attempt to fix newbies’ bad habit of vertically spacing with empty paragraphs)


This is a single paragraph, making reorganising your document easier (you can’t forget to move the Decor paragraph). Operations with the Navigator are then more reliable and always consistent.

1 Like

I’m not too sure about what a cul-de-lampe is, I really wanted to add a short underline under the Heading 1 possibly shorter than the text above.

Who ever said more presence would be a better thing? I really need just need a short underline.

Sorry, I didn’t tag it as a possible workaround. What you want, an underline of text for which you can set the distance from the text and that matches the length of text is not available. If you are OK with a short underline that doesn’t change length then the same method could be used with a simple drawing line.

You could post an enhancement request, How to Report Bugs in LibreOffice - The Document Foundation Wiki