[Tex/LaTex] Paragraph breaks with asterisks

formattingpage-breaking

In many books—mostly novels—often some paragraphs will have a blank line between them to indicate a sort of 'pause' in the narration. If one of these blank lines appears at the top or bottom of the page, it's replaced with "* * *" so that the reader knows there's a break.

When I put these blank lines in my LaTeX documents, I use a tilde like this:

stuff blah blah paragraph ends here

~

new paragraph, more stuff...

This works fine for the most part, but of course it won't put in the asterisks for me if it occurs at the top or bottom of a page. Is there a way to do this automatically?

Best Answer

You could hide the ornament with a discardable item:

\documentclass{minimal}

\usepackage{xcolor}
\usepackage{xparse}

\makeatletter
\ExplSyntaxOn
\box_new:N \g_hide_box

\AtBeginDocument {
  \vbox_set:Nn \g_hide_box {
    \color@begingroup
    \color { white }
    \hrule width \linewidth height \baselineskip depth \c_zero_dim
    \color@endgroup
  }
}

\NewDocumentCommand \ornament { } {
  \par
  \nopagebreak
  \centerline { $ * \quad * \quad * $ }
  \vskip -0.8\baselineskip
  \cleaders \box_use:N \g_hide_box \vskip 1.1\baselineskip
  \par
}
\ExplSyntaxOff
\makeatother

\begin{document}

\ExplSyntaxOn
\prg_replicate:nn { 50 } { aaa \ornament }
\ExplSyntaxOff

\end{document}