Auto-capitalization after numbers, parenthesis and a dot

Is there a way to enable auto-capitalization after sentences ending in numbers, parenthesis and a dot, like “1994).”?

tdf#116718

Related question: Can I enable auto-capitalization for a new line (Enter)?

Since your sentences ends “normally”, i.e. with a full stop (period), standard AutoCorrect will do the job.

Go to Tools>AutoCorrect>AutoCorrect Options, Options tab and tick Capitalize first letter of every sentence.

PS: when asking here always mention OS name, LO version and save format. There are differences between platforms and formatting is guaranteed stable only in native format.

“Capitalize first letter of every sentence” does’t work. Win 11, Writer 7.5.4.2, save format .odt.

Then attach a sample file so that I can see your exact context.

Untitled 1.odt (10.7 KB)

From experiment, I think auto-capitalisation is automatically disengaged after something looking like list numbering. The parenthesis doesn’t play an essential role here. The critical sequence is digits symbols period where symbols is an optional sequence of non-alphanumeric characters.

If the idea is to refuse to auto-capitalise items in a list, this may be faulty. It is correct in an enumeration like potatoes, apples, beans, but incorrect when the items are full sentences. And this can’t be detected on the first space character.

Can I via Tools > Autocorrect > Autocorrect Options… > tab Replace, somehow replace all sequences “dot” AND “Space” OR “Enter” with the same plus a new sentence marker?

It may be less trouble to just enter your text, not bothering about such errors all the time, and then from time to time scan the text for such errors, using regular expressions.

Use \. [a-z] as the search text, tick Regular expressions in the search options (click Other options to reveal more search options).

2 Likes

Thanks. Although this is not a solution, I (with also enabled box “match case”) can find

[0-9]\)\. [:lower:]

or

\)\. [:lower:]

No, because the Replace string is not a full-fledged regexp. You can’t capture part of it to forward it to the With string. This means you’ll have to create 26 entries at least (a-z plus eventually letter+diacritics). I don’t think it’s worth the pain. See @anon87010807’s suggestion.

1 Like

I tried to start typing 26 entries autocorrect, but it just doesn’t work, because it only works for a single letter, not for a word. As for the search, I found all the errors where there is no transition to a new paragraph, but for some reason I could not find anything in the case of a new paragraph. The “$” from “Regular Expressions” finds the end of a paragraph, but does not find the next character. It’s like there’s an invisible character between the end of a paragraph and the first visible character of the next paragraph that I couldn’t find.

I mean,

[:digit:]\)\.$

Finds place in text like

Some text (1958).
Another text

But if I add to “[:digit:]).$” symbols like . (any single character except a line break or a paragraph break), ^ (beginning of a paragraph), [:print:] ( a printable character), [:cntrl:] (a nonprinting character), [:lower:] (a lowercase character), and so on, it finds nothing. Why?

P.S. Ok, I simply find by

^[:lower:]

That works.

In AutoCorrect replace table, you have only a wildcard pattern, indeed a very rudimentary regexp. The primary role is to correct while typing. I.e. only a very small context is needed. In fact, your typing is permanently monitored and as soon as a replace target is recognised, the wth string is substituted. The wildcard is .* (period asterisk). Then due to the limitation, $ or ^ stand literally for DOLLAR SIGN or CIRCUMFLEX ACCENT.


Edit>Find & Replace operates on a single paragraph at a time. Consequently, what you search can be found only if it is inside a paragraph. Anything which straddles a paragraph break can’t be found. Nothing can precede ^ in a regexp nor follow $.

The simplest solution is to not rely on AutoCorrect and type whatever is correct under your language grammar. You’re then in full control.

The built-in Spell Check (F7) will offer corrections for grammar too if the options are set in in Tools > Options > Language Settings > English Sentence Checking. Tick boxes :ballot_box_with_check:Possible mistakes, :ballot_box_with_check:Capitalisation, and any others you feel are wanted. Cheers, Al

2 Likes