fabien van mook

all packages "fvm-*"

package "fvm-miscellaneous"

function file "alinea.m"

Function r = alinea(s)
         r = alinea(s,o)

returns a new string r, based on a one-dimensional
cell array of strings, s. Each element in s will 
result in a paragraph (alinea).

Optional input argument o contains formatting 
directives, and is a one-dimensional cell array
of key-value pairs:

 key      value type   default value
 ---      ----------   -------------
 "indent" string       "-- "
 "margin" string       "   "
 "align"  character    "r" (right text alignment)
         other values: "c" (center text alignment)
                       "l" (left text alignment)
                       "p" (preserve, no alignment)
 "remove_nl" boolean   0
          other value: 1 (when "align" is "r", "c" or "l")
 "width"  integer      70
 "end"    string       ""
 "join"   string       "\n"

One can represent the resulting string by the following
scheme:

  <indent><text_from_s{1}....><newline>
  <margin><text_from_s{1}....><newline>
  <margin><text_from_s{1}....><end>
  <join>
  <indent><text_from_s{2}....><newline>
  <margin><text_from_s{2}....><end>

The function works properly if only the character
"\n" is used to indicate line endings.


(c) 2026 fabien van mook

2026.08.20 release of this file within package "fvm-miscellaneous" under GNU GPLv3+