How to insert line after every period/sentence end.

Discuss the word processor
Post Reply
jacksparrowjive
Posts: 8
Joined: Sun Apr 11, 2021 1:30 am

How to insert line after every period/sentence end.

Post by jacksparrowjive »

HI all. I would like to test something and would like to try inserting a blank line after every period/end of sentence.

To clarify, I do not simply want to change the line spacing, which is purely visual. I want there to be an actual line after every period/end of sentence, as if I had hit enter twice before starting the next line of text.

If there is a command for this it would be greatly appreciated. Thank you in advance for your help!
OpenOffice 4.1.6 / WIN10
User avatar
Zizi64
Volunteer
Posts: 11362
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to insert line after every period/sentence end.

Post by Zizi64 »

If there is a command for this it would be greatly appreciated.
That "command" is:
Find ans Replace - together with the Regular Expressions.
https://help.libreoffice.org/4.2/Common ... xpressions

Do you want insert empty Lines by inserting LineFeed character or empty Paragraphs by inserting ParagraphEnd character?
You need substitute all of the sentence end characters to itself+2*LineFeed/ParagraphEnd character.

1. Write into the Search box: "[.?!]" (without quotation marks)
2. For inserting same text into the document, write into Replace box "what was searched": "&" or "$0"
3. The built-in F&R function can insert ParagraphEnd charater only. RegEx value: "\n". You need two pieces of it, one for paragraph end, and an another for an empty paragraph: "\n\n".
4. The full content of the Search box:

Code: Select all

[.?!]
The ful content of the Replace box:

Code: Select all

&\n\n
5. Check-in the Regular Expressions option, then Replace all.
F_and_R.png
 Edit: I tried it: Works fine in my LO 6.1.6. 

The Alternative Find&Replace Extension can insert LineFeed character. The codes for the Replace box:
LineBreak: &\n\n
ParagraphEnd: &\p\p
 Edit: (I just tried it. The AltSearch extension stopped with Error message.) 
Last edited by Zizi64 on Thu Nov 18, 2021 12:00 pm, edited 1 time in total.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
JeJe
Volunteer
Posts: 2784
Joined: Wed Mar 09, 2016 2:40 pm

Re: How to insert line after every period/sentence end.

Post by JeJe »

doing a search for what's in the quotes below (but not including the quotes) and nothing in the replace box should tidy up Zizi64's result
"^ |^ "
Regular expressions need to be checked

^means find the start of the paragraph. The pipe symbol | allows you to find multiple things so that expression finds the start of the paragraph and two spaces and the start of the paragraph and a space.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
robleyd
Moderator
Posts: 5087
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: How to insert line after every period/sentence end.

Post by robleyd »

To clarify, I do not simply want to change the line spacing, which is purely visual. I want there to be an actual line after every period/end of sentence, as if I had hit enter twice before starting the next line of text.
You are describing adding an empty paragraph. You could change the style that you are using for the paragraphs to increase the spacing below the paragraph; this will give the same effect as inserting an empty paragraph. Note that this is not the same as changing the line spacing.

Should you need to revert, it is as simple as editing the style to vary the spacing after paragraph.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
Post Reply