Arranges documents in a paragraph-like layout. Returns a document representing all possible left-aligned paragraph-like layouts of the (nonempty) sequence Docs
of documents. Elements in Docs
are separated horizontally by a single space character and vertically with a single line break. All lines following the first (if any) are indented to the same left column, whose indentation is specified by the optional Offset
parameter relative to the position of the first element in Docs
. For example, with an offset of -4, the following layout can be produced, for a list of documents representing the numbers 0 to 15:
0 1 2 3
4 5 6 7 8 9
10 11 12 13
14 15
or with an offset of +2:
0 1 2 3 4 5 6
7 8 9 10 11
12 13 14 15
The utility function text_par/2
can be used to easily transform a string of text into a par
representation by splitting it into words.
Note that whenever a document in Docs
contains a line break, it will be placed on a separate line. Thus, neither a layout such as
ab cd
ef
nor
ab
cd ef
will be generated. However, a useful idiom for making the former variant possible (when wanted) is beside(par([D1, text("")], N), D2)
for two documents D1
and D2
. This will break the line between D1
and D2
if D1
contains a line break (or if otherwise necessary), and optionally further indent D2
by N
character positions. The utility function follow/3
creates this context for two documents D1
and D2
, and an optional integer N
.
See also: par/1
, text_par/2
.