# Paragraph breaks with asterisks

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?

-
In plain TeX, I think I would resort to output routine hacking in order to achieve this. But I wouldn't dare mess with the LaTeX output routine. – Harald Hanche-Olsen Dec 19 '10 at 9:28
@Harald It is possible to have a solution using everypar. You need to box all the paragraphs and then add a macro for the ornament. These ornaments - sometimes are called thought breakers. There some good ones available at ctan.org/tex-archive/fonts/webomints. – Yiannis Lazarides Dec 19 '10 at 10:46
@Yiannis: I don't see how boxing paragraphs will help. Care to elaborate? As I see it, the main problem is to find out if there is room for zero or one line of text on the current page, or if we are already on the top of a new page. Due to the asynchronous nature of TeX, only the output routine can answer this question satisfactorily. And I don't know how to ask this sort of question of the LaTeX output routine, or how to tweak it so it will answer the question. – Harald Hanche-Olsen Dec 19 '10 at 11:47
@Harald See my reply below with some suggestions and a semi-automatic way. – Yiannis Lazarides Dec 19 '10 at 12:55

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
\par
}
\ExplSyntaxOff
\makeatother

\begin{document}

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

\end{document}

-
Nice to see LaTeX3 code around. Care to explain the discardable item a bit more? You just hide the box by coloring it white at every paragraph except at end of page? – Yiannis Lazarides Dec 19 '10 at 20:53
@Yiannis Lazarides: Exactly. That is quite crude, but I didn't find another way that doesn't mess with the output routine. (To my surprise, I also didn't find a post_pagebreak_filter in LuaTeX). I exploit the fact that leaders are discardable vertical items (e.g. they are ignored at page breaks) to place a white rule above the asterisks. – Philipp Dec 19 '10 at 22:42
Finally got to test it; it works like a charm. Thanks! – Andrew Arnold Dec 31 '10 at 6:06

The memoir document class has a command \plainfancybreak (or \pfbreak) which provides breaks which have asterisks only when they coincide with page breaks.

-
...more detail on this is found in the memoir package documentation. Specifically, section 6.7 Fancy anonymous breaks (on page 109). – Werner Aug 4 '11 at 22:19

Is there a way to do it automatically? My understanding is that there is no current package that can do it. However, here is a semi-automatic solution! The macro uses a special font (webomints) available at http://www.ctan.org/tex-archive/fonts/webomints/

\documentclass[a4paper]{article}

\newcommand{\wb}[2]{\fontsize{#1}{#2}\usefont{U}{webo}{xl}{n}}
\newcommand{\wbc}[3]{\vspace*{#1}\begin{center}
\wb{#2}{#2}#3\end{center}\vspace*{#1}}

\def\thoughtBreak{ \wbc{2ex}{6}{IJLKIJLKIJLKIJLKIJ}}

\begin{document}

\textsc{The King and Queen of Hearts} were seated on their throne
when they arrived, with a great crowd assembled about them
--- all sorts of little birds and beasts, as well as the
whole pack of cards: the Knave was standing before them,
in chains, with a soldier on each side to guard him; and
near the King was the White Rabbit, with a trumpet in one
hand, and a scroll of parchment in the other.  In the very
middle of the court was a table, with a large dish of
tarts upon it: they looked so good, that it made Alice
quite hungry to look at them --- I wish they'd get the
trial done,'' she thought, and hand round the
refreshments!''.  But there seemed to be no chance of this,
so she began looking at everything about her to pass away
the time. \thoughtBreak

Alice had never been in a court of justice before, but she
find that she knew the name of nearly everything there.
That's the judge,'' she said to herself, because of his
great wig.''.\thoughtBreak

The judge, by the way, was the King, and as he wore his
crown over the wig, (look at the frontispiece if you want
to see how he did it,) he did not look at all comfortable,
and it was certainly not becoming. \thoughtBreak

\end{document}


What you are referring to are normally termed ornaments or thought breakers. I prefer the latter, as a paragraph is a unit of thought and not a unit of text! I defined a macro called a \thoughtBreak which you add at the end of a paragraph. It does not solve the problem of orphan ornaments, i.e. you will still need to rely on TeX's penalty system to ensure that the ornaments are not moved over to the first line of a new page.

Possible solutions to automate it, is to use the approach used by the lineno package to number the lines of a paragraph and add the \thoughtBreak at the end of the paragraph. Another possible solution is to redefine the \par command that normally ends a paragraph. The latter can get messy as par is used in all sort of other places as well i.e., captions, lists ...

Lastly you can play with the output routine which is the right way to go - as you can also check ahead for sections etc (you don't want ornaments to end a paragraph if a section follow). This can get very messy to debug and program and LaTeX output routine is admittedly almost impossible to hack!

-
Methinks you are solving a different problem, though: The OP wanted just a blank space between some paragraphs, to be replaced by an ornament if (and only if) there is a page break between the paragraphs. – Harald Hanche-Olsen Dec 19 '10 at 15:24
@Harald Methinks I didn't read the small print! Oouch! – Yiannis Lazarides Dec 19 '10 at 20:44

This LuaTeX solution seems to be quite robust:

\documentclass{minimal}

\usepackage{xparse}
\usepackage{luatexbase}
\usepackage{atbegshi}

\ExplSyntaxOn
\newluatexattribute \g_orna_attr
\box_new:N \OrnamentHideBox
\vbox_set:Nn \OrnamentHideBox {
\null
}
\int_const:Nn \c_orna_attr_int { \lua_now:x { tex.sprint(luatexbase.attributes.g_orna_attr) } }
\NewDocumentCommand \ornament { } {
\par
\vbox attr \int_use:N \c_orna_attr_int = 1 {
\centerline { $* \quad * \quad *$ }
}
\par
}
\ExplSyntaxOff

\AtBeginShipout{%
\directlua{%
for n in node.traverse_id(1, head) do
if node.has_attribute(n, luatexbase.attributes.g_orna_attr, 1) then
if n.next and n.next.next then
node.flush_list(n.list)
n.list = node.copy_list(tex.getbox(\number\OrnamentHideBox).list)
end
else
remove_ornaments(n.list)
end
end
end
local box = tex.getbox(\number\AtBeginShipoutBox)
remove_ornaments(box.list)
}
}

\begin{document}

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

\end{document}

-

(EDIT: I just noticed that I have completely misunderstood the question – I’ll still leave my answer here in the hope that someone may find it useful.)

I wouldn’t put such an ornament after every paragraph – paragraphs should be used very frequently (IMHO, every few sentences) and having an ornament that often will become distracting.

Rather, I would define a command to explicitly insert such an ornament where ever it makes sense. Alternatively, you could redefine the \subsubsection command (or another sectioning command) to insert such an ornament.

For my thesis document class, I have defined such a command which allows the following usage:

This is some text.
Some more text.

New paragraph with more text (indented by \verb/\parindent/ = \the\parindent).

\hr

This is after a big skip (notice: no indentation)

\hr*

This is after an ornamented big skip (still no indentation).


Which yields the following output:

I’m calling it \hr (which stands for “horizontal rule”) because that’s the name of this element in HTML (and in HTML, it’s by default rendered as an actual rule).

There are two versions of the macro: \hr, which just inserts the space, and \hr*, which additionally inserts an ornament.

My \hr macro can be configured by two other macros:

• \hrskip (default: \baselineskip) which is the size of the space between the paragraphs, and
• \hrornament which specifies which ornament to use.

\hr is defined as follows:

\newlength\hrskip
\setlength{\hrskip}{\baselineskip}
\newcommand*\hrornament{\ding{167}}

\newcommand*\hr{\hr@starornot}

\WithSuffix{\newcommand*}\hr*{\hr@starornot[*]}

\newcommand*\hr@starornot[1][]
{\begingroup%
\par\vspace{0.5\hrskip}%
\ifx#1*
\noindent\centering \hrornament%
\else
\fi%
\vspace{0.5\hrskip}%
\par%

(The \WithSuffix command requires the suffix package. The default ornament requires the pifont package but you can use basically any other ornament instead.)
I recognize this is an old issue and I'm committing thread necromancy. The memoir class has \pfbreak{} that does exactly what you're asking for.