Function s = textblockfit(s)
s = textblockfit(s,opt)
applies textblockpad(s,..) to the string(s) in s, so that
text blocks with certain line widths and line numbers are
obtained which will tightly fit in a two dimensional
table.
The input argument s is a character row vector or a
cell-array of character row vectors. The output argument
will have the same form as the input argument s.
The optional input arugment opt is a struct or a row
cell-array of key-value pairs. Below, settings are
indicated by opt as a struct, and the default value of
each field are given too:
opt.nline = [];
opt.nline indicates the desired total number of
lines. (*)
opt.width = [];
opt.width indicates the desired total number of
characters on each line. (*)
opt.linedelim = "\n";
opt.linedelim contains the line delimiter, i.e. the
character by which lines are separated within a
string.
opt.fillchar = " ";
see into the help text of m-file textblockpad.m.
(*) These options may contain empty matrices [], or
scalars, or matrices with the same sizes as the input
argument s, if s is a cell-array of character row vectors.
Empty matrices indicate, that opt.nline and opt.width must
be calculated based on the given strings.
The function internally calls the following non-standard
m-files:
-- kvpairs2struct.m
-- textblocksize.m
-- textblockpad.m
(c) 2026 fabien van mook
2026.08.20 release of this file within package "fvm-textblock" under GNU GPLv3+