groff
[Top][All Lists]
Advanced

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

Re: A few observations regarding tbl


From: G. Branden Robinson
Subject: Re: A few observations regarding tbl
Date: Sun, 20 Jun 2021 08:15:56 +1000
User-agent: NeoMutt/20180716

Hi Oliver!

At 2021-06-18T15:15:45+0200, Oliver Corff wrote:
> I thought over the subject and I decided to write a new introduction
> to tbl, akin to Lesk's introduction, but under FLOSS license and with
> a focus on the gnu extensions.

That's terrific!  I don't think it's necessary to belabor the GNU
extensions.  I think they should be identified as such for those who
care, but most of our audience is not going to need to write tbl(1)
tables that are portable back to Version 7 Unix.

I haven't yet researched this to my satisfaction, but I _think_ the "x"
modifier on column formats is not quite a GNU extension, but a DWB troff
one, which GNU further extended by permitting more than one column to
have it.

> For this purpose, I have one obviously uninformed and stupid question.
> How do I show code examples in groff (I think I'll opt for the ms
> macro set) with the whitespace character 0x20 marked, akin to the
> \verb*|...| command in LaTeX? \verb|...| produces the included text in
> tt courier (or another fixed-pitch font suitable for displaying code)
> with spaces shown as blank, whereas \verb*|...| inserts a special
> symbol for every 0x20 character.

Since you're working with ms(7) as your macro package, I'd urge you to
peruse doc/ms.ms in our Git repository[1].  As mentioned last year, I've
been working on bringing Larry Kollar's document up to date with changes
made to groff ms over the past 20 years.  (And also fiddling the thing
to death as I am wont to do with documentation.)

That's just to give your ms writing a refresher; I wouldn't necessarily
follow the pattern used there for code examples.  Because they often
show source and rendered content side-by-side, the document uses tables.
But since tables can't nest, that may not work well for what you have
planned.

My first inclination would be write macros to start and end the
examples, and have them use a boxed display with a font family change.
I've attached the source and output PostScript.

> Does the ms macro package feature an environment for displaying source
> code, or do I mimick that with font and margin settings?

You do have to change the font family, but that's better done with the
FAM string the package supports.  You shouldn't have to mess with
low-level margin-setting requests.  If you use a display macro, you can
set the DI register to determine its indentation.  If you don't use a
display macro, I'd probably set PI and use .RS and .RE.

> Since my introduction will demonstrate things like nospaces, tab
> settings etc., it would be nice to show the spaces in the source code.

As noted later in the thread, there's no great solution for this.  I
like the open box, but if that glyph isn't portable enough, I suppose
I'd go with a bullet \[bu].

Regards,
Branden

[1] https://git.savannah.gnu.org/cgit/groff.git/tree/doc/ms.ms

Attachment: tbl-intro.ms
Description: tbl-intro.ms

Attachment: tbl-intro.ps
Description: tbl-intro.ps

Attachment: signature.asc
Description: PGP signature


reply via email to

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