First letter styling?

(LO Writer 25.8)

I’m writing (or rather, translating) some poetic verse which is alphabetic acrostic, and wanting mild highlighting of the first letter, thus:

Alphabetic acrostics have lines that

Begin with alphabetic letters

Consecutively appearing

Down the left hand

Edge of the page…

For that demonstration above, I was able to ‘bold’ that initial letter by handcrafting each occurrence.

And so to LO. And I’m assuming that in LO each line would be a paragraph, but I’m open to better suggestions.

I haven’t seen a way in LO to do such first-letter re-styling. There’s DropCaps but that (a) feels designed for its own, different, multi-line purpose; and (b) seems not to allow more general restyling (e.g. colour, font, small %-age size increase, etc.) of the first letter.

For reference, I develop and maintain this real-life, use-case versification on my website. For that, CSS offers its “::first-letter” pseudo-element, which seems to work well, allowing quite general re-styling of the first letter. It’s here: ServiceMusic: Lamentations 1

Does LO offer something similar to CSS “::first-letter”?

You could use SEARCH&REPLACE tool after finishing your text creation.
Find the 1st letter, then double click on Strong Emphasis (character style).
1st letter is found as 1st letter of a paragraph.
(You may use the Formatting (Styles) toolbar for quicker formatting.)

See attached screenshot:


tdf#70180

It allows that perfectly.

Thanks.

Ideally I’m looking for some sort of styling which can do this by default, so that the effect is applied during creation and also during subsequent editing and maintenance.

On the positive side, it’s good to see the topic open for discussion. Thanks.

But on the not-so-positive side, I see it is over 12 years old (Oct 2013) and appears not to be making much progress. How might we get it moving?

Apologies for the silence over the last couple of weeks. (Domestic stuff, etc.)

Recall that the concept required here is a paragraph style in which the first letter (a variant might be first word) can have flexible styling. In my sample use-case imagine bold, colouring, etc.

As far as I know, Writer lacks this concept. And the above discussion seems to bear witness to this absence.

The nearest seems to be “Drop Caps”. Now… if I select that, then I can add a little styling: under “Character Style”, “Strong Emphasis” can be selected. So there is a little styling possible, but not the wider range.

If the paragraph wraps to multiple lines, then the “Drop Caps” works. And it includes that (restricted) extra styling.

BUT… if the paragraph is short and doesn’t wrap then the entire “Drop Caps” styling of the opening letter or word is abandoned.

Attached is a screen shot. On the long paragraph things work as expected (Drop; accompanied by “strong emphasis” styling). But on the short paragraph, because the "Drop"ping of the character/word is inapplicable, then also the additional styling doesn’t happen: its “Lorem” does not receive “strong emphasis”.

Bugzilla 70180 is related but is over 12 years old and seems stalled. (Nevertheless, I’ve joined it.)

Rather than trying to coerce Drop Caps into this styling, it seems we need a more general “first-letter/first-word” idea, with Drop Caps being just one attribute among many that can be supported by it.

Screenshot 2025-12-13 171624

1 Like

  • You can also use an image as a drop cap, but it is more difficult.
1 Like

You will find every first word in every paragraph with ^\w+[^\s] and regular expressions enabled within ordinary find-and-replace:


up to the first space



inclusive the first space

Thanks. That’s “fix up each and every occurrence manually and interactively after the event”. (Workaround. And error-prone if there are many instances, multiple editors, extended time periods, etc.)

From a deeper perspective, I’m also (in parallel, if you like) wondering about LO supporting this via styling, so that the styling works automatically, including when the document is being maintained and edited and changed over an extended period, perhaps by several quite independent people.

…is not known to me! Since keywords are already highlighted in bold within the first sentence, this must be done manually.

Not a perfect workaround, but…
Deleting the first character, and choosing a character numbering, with a character style, does it.
First letter styling.odt (12.1 KB)


imagen

1 Like

I’m looking at this on two tracks:

  1. The immediate issue (in ITIL terms, the “incident”), and workaround for the user (me) to make progress on it. And your idea, @LeroyG, looks like a useful way forward in my particular “alphabetic acrostic” case. (There’s a more obscure sub-issue in my own case. This particular “alphabetic acrostic” has another constraint of requiring the omission of four letters scattered across the text; the source for the translation Hebrew which is only 22 letters rather than 26. So at four points, a letter needs to be omitted. But I like the idea, and the thought leading to it. Thanks. It so happens that I’m choosing to hack it manually).

  2. An underlying weakness that requires deeper examination and work to address (in ITIL terms, the “problem”). Addressing this will assist future users who find they want something similar. I’m intending to propose a feature request. And, if there is agreement in principle, I would consider downloading the code and drafting a pull-request (or gerrit’s equivalent of such a thing… I’m very familiar with git but know nothing yet of gerrit).

Thanks again.

If you are brave enough, here is a hack.

  1. Keep explicitly the line(s) for the to-be-skipped-letters. Just enter a verse/item containing a dash or other convenient “flag”.
  2. Select from the position before the paragraph mark of the preceding list item to the position before the current paragraph mark. The selection contains the previous paragraph mark, the numbering letter and your flag.
  3. Format>Paragraph: in Indents & Spacing, make sure spacing above and below are zero
  4. Format>Character
    1. in Font, reduce size to 2pt; don’t touch anything else
    2. in Font>Effects, set Font color to white (or the colour of your final document background)

Since you’ll probably reuse this formatting, it may be convenient to record them in a single paragraph style. In this case, you need not make the convoluted selection above. Just apply your style to the to-be-skipped item and you’re done.

Not obvious which number to choose instead of a letter, but works:
image

Partly. This is the dropcap feature. But it won’t give the result you expect because it can’t be reduced to operate on only one line.

You configure it in the Drop Caps tab of paragraph style configuration. You associate a character style to the drop cap to format it differently than default. This style can be built-in Drop Caps.

In the example above, if your verses are paragraphs, enable drop cap. The selected character style will be automatically applied to the first letter (if so configured). Note you can’t modify font size. So use other attributes to highlight your first letter.

If your paragraph contain multiple verses (separated by line breaks Ctl+Enter, add a tab after it to indent the second line and have a blank space betwee the 2-line drop cap and the verse. Customise Before text indent and First line indent to create a hanging indent.

See example AskLODropCap.odt (25.5 KB)

The screenshot of the example shows a 2-line paragraph with tab and a 1-line verse. Next is a long paragraph without tab in the second line resulting in a weird look.

image

a) Wrong. Drop Caps by default is not associated to the feature. You must select it yourself. By itself, it does nothing because it is not activated.
b) Drop Caps can be modified any way you like. When used with the dropcap feature, only font size becomes ineffective because glyph resizing is managed dynamically.

Don’t do that. Direct formatting is the root of all evil. Instead, apply character styles.

That’s basically correct, but if the line is the only one of the paragraph, the dropcap will automatically be reduced to one line.
See also the text in the attached example with additional remarks.
(Remins the missing alignment for the second character…)
disask_129315_1_line_dropcaps.odt (19.0 KB)
The actual behaviour is too complicated as to be describable by me.

Absolutely! I really want to get this right structurally, so I really want to adopt the “styles” workflow in both creation and subsequent editing and maintenance. My day-job has involved significant software engineering, so working cleanly with programming concepts is dear to my heart.

I new to working at this sort of level with LO, but want to “get it right”. I had mentioned the CSS ::first-letter analogy because that’s working cleanly for me in the original web version of this project. So my starting point is looking for something in LO that feels structurally similar to that CSS, because that’s exactly the concept I’m after: for these sort of poetry-viewpoint verse-lines (probably represented in LO as “paragraphs”), can I apply visual emphasis to the first letter? A sufficient minimum for that “visual emphasis” is simply “bold”.

This is the dropcap feature. It is configured in the Drop Caps tab of any paragraph style. You can assign a character style to the effect to make it different from general paragraph formatting.

Unfortunately, there are two limitations:

  • the feature takes ownership of the dropcap size, i.e. font size specified in the character style is ignored
  • if the paragraph has only one line (or more generally fewer lines than what is requested by the settings), the number of lines for the dropcap is reduced to the number of lines in the paragraph
    In other words, with a single line verse, your drop cap has the same height as the rest of the line. You can only play with weight, face or colour. See the second paragraph in my sample or screenshot.

Given that Drop Caps doesn’t do the job for single lines then a simpler way to select the first character of left -aligned text is to

  1. Create a character style from Default character style and style it as you like, maybe name it Acrostic
  2. Click Edit > Selection Mode > Block Area (Alt+Shift+F8)
  3. Select the first letter of the entire text then double click Acrostic character style to apply it.

This works for paragraphs and for line breaks
Acrostic.odt (12.9 KB)

Maybe you could volunteer to fix the bug report? Developers | LibreOffice - Free and private office suite - Based on OpenOffice - Compatible with Microsoft

Yes, I could look into attempting it. But while all my software work has been on UNIX/Linux, my LibreOffice is WIndows-11, an environment where I have never done any software development at all!

But prior to that we need to clarify:

  • have I simply overlooked a facility that is already there?
  • is my request a bug… in which case “fix” is the right way forward
  • is my request a new feature… in which case does it need a proposal/discussion, and where?

Thanks for the encouragement to take the next steps.