groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tbl] Setting the widths of the columns


From: G. Branden Robinson
Subject: Re: [tbl] Setting the widths of the columns
Date: Fri, 28 Apr 2023 16:39:42 -0500

Hi Frederic,

At 2023-04-28T23:18:34+0200, Frederic Chartier wrote:
> Until now, my dealings with tbl(1) have been infrequent, casual
> and pleasant. This time, I need actual control over the widths
> of the columns. Specifically, I want column 1 to be exactly as
> wide as its contents requires, columns 3 and 4 to have specific
> (and different) widths and column 2 to take up the remaining
> horizontal space on the page.
> 
> I've spent a lot of time trying different things without
> success. I think that the root of the problem is that you can
> set a minimum width (with column specifier "w") but not a
> maximum width.
> 
> Am I missing something obvious ? Thanks in advance.

It sounds like you want a table format description like this.

L Lw(1i)z Lw(2i)z Lx.

Per tbl(1) from groff 1.23.0:

  Column modifiers
    Any number of modifiers can follow a column classifier.  Arguments
    to modifiers, where accepted, are case‐sensitive.  If the same
    modifier is applied to a column specifier more than once, or if
    conflicting modifiers are applied, only the last occurrence has
    effect.  The modifier x is mutually exclusive with e and w, but e is
    not mutually exclusive with w; if these are used in combination,
    x unsets both e and w, while either e or w overrides x.
[...]
    w, W
        Set the column’s minimum width.  This modifier must be followed
        by a number, which is either a unitless integer, or a roff
        horizontal measurement in parentheses.  Parentheses are required
        if the width is to be followed immediately by an explicit column
        separation (alternatively, follow the width with one or more
        spaces or tabs).  If no unit is specified, ens are assumed.
        This modifier sets the default line length used in a text block.

    x, X
        Expand the column.  After computing the column widths,
        distribute any remaining line length evenly over all columns
        bearing this modifier.  Applying the x modifier to more than one
        column is a GNU extension.  This modifier sets the default line
        length used in a text block.

    z, Z
        Ignore the table entries corresponding to this column for width
        calculation purposes; that is, compute the column’s width using
        only the information in its descriptor.
[...]
    Ordinarily, a table entry is typeset rigidly.  It is not filled,
    broken, hyphenated, adjusted, or populated with additional inter‐
    sentence space.  tbl instructs the formatter to measure each table
    entry as it occurs in the input, updating the width required by its
    corresponding column.  If the z modifier applies to the column, this
    measurement is ignored; if w applies and its argument is larger than
    this width, that argument is used instead. [...]

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]