Indent on paragraph first line

Paragraphs in LibreOffice Writer support indentation for the first line of the paragraph, but I’m looking for a little more flexibility.

When the paragraph is the first on a page after a heading or when a paragraphs are separated by a blank line I don’t want this to happen.

Think of a book, that’s the result I’m trying to accomplish. In the example below the Lorem ipsum text is a little short, to keep it simple.


[First paragraph: no indent]
Lorem ipsum dolor sit amet, consectetur adipiscing elit.  
  [Second paragraph: indent]
  Praesent fringilla ipsum ut dolor egestas blandit. Integer convallis pharetra sollicitudin.

[First paragraph after white line: no indent]
Cras ut rutrum risus. Integer non massa urna.  
  [Second paragraph: indent]
  Quisque turpis sapien, tincidunt sed hendrerit iaculis, semper vel leo. 

I’m using the Text body style, first line indentation on Automatic, no spacing above and below paragraphs.

Any ideas on how to accomplish this without going through every page to set this style manually? Is there some conditional setting I missed or is there another approach to accomplish this?
It’s some 300 pages I have to apply this to so I’d rather not go through that.

@tohuwawohu (I can’t seem to find a way to directly comment on your answer…) It is the solution I need, but like I said I can’t go through the 300 pages and apply them on every occurence.

@tohuwawohu Also I’m not entirely sure what you meant with the WhiteLinePar. Would I have to apply a special style to a white just so the next one is without indentation? Is there a way I could apply that to all white lines in one go?

Using a dedicated paragraph style for the empty lines was just one idea how to make LO insert the FirstPar style automatically. A “cleaner” solution would be to have two FirstPar styles with different top spacing. To apply the styles automatically afterwards, i fear you’ll need a macro.

@tohuwawohu made two macros, one for searching for the next paragraph (regular expression ^$) and one to select and replace the text body style with a new custom style. Takes a few minutes to work through the entire document, but it’s a lot better than doing everything manually. Thanks for the help!

Great - i’m very happy to hear that you found a solution!

Generally, you could do this using different paragraph styles and using the “Next Style” setting. Just create another “FirstPar” paragraph style with no indentation, based on the default paragraph style. Then, set the “FirstPar” as “Next Style” in the heading style, and set the default paragraph style as “Next Style” in the “FirstPar” Style:

Heading —> FirstPar —> DefaulPar

Same with white line:

WhiteLinePar —> FirstPar —> DefaultPar

Now, the problem is applying those styles to your existing documents. IMHO this is the “real” problem, since if you change the “Next Style” setting for a given style, the “next Style” won’t get applied automatically - it seems to work only if entering a paragraph break using the “Enter” key. Maybe someone knows how to propagate changes of “Next Style” settings to existing content.

Nice approach! I’d do it the other way around though. Use no indentation on DefaultPar/plaintext and set “Next Style” to IndentPar. That way one wouldn’t have to change “Next style” on any other style, such as citation, all different headers, etc.