groff
[Top][All Lists]
Advanced

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

Re: [Groff] Creating a table macro


From: Automation Department
Subject: Re: [Groff] Creating a table macro
Date: Thu, 19 May 2011 12:12:35 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Lightning/1.0b2 Thunderbird/3.1.10

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks Ted.

This is helpful. Currently I am using two column tables for creating
diagrams explaining command syntax. The number of columns and formatting
remain the same but row-count is the changing variable.

Are there resources you would suggest that draw together the pieces
necessary for writing groff macros? I've read Provins, Lesk the info
pages and am looking through the tmac files currently. The tmac files
hold promise but was hoping for a more basic resource that explains some
of the issues with newlines, escapes and macros or ds calls within
macros, building strings ...etc.

Thanks again ~ your example illuminates some things.  Will play around
with it.

Chad Roseburg


On 05/19/2011 01:14 AM, (Ted Harding) wrote:
> Here is an example, using the approach I described earlier,
> to achieve the sort of thing you are looking for. This does
> a 1-line table. A multiline table would require a slightly
> different approach, and I will work one out later!
> 
> Some details of the formatting below are there to verify
> that it is working as intended (e.g. the ""ce" and le" for
> equal width columns). Such things can be changed according
> to taste. Similarly the use of "#" as delimiter may depend
> on what content you want to put in the table.
> 
> Ted.
> ==========================================================
> 
> .\" One-line table with arbitrary cols
> .\" Usage:
> .\" .Tbleone <args>
> .de Tblone
> .nr nargs \\n[.$]
> .ds cols ce
> .ds tabline \\$1
> .while (\\n[nargs] > 1) \{\
> .shift
> .as cols " le
> .as tabline #\\$1
> .nr nargs -1
> .\}
> .open TBL tbltemp
> .write TBL .TS
> .write TBL allbox tab(#);
> .write TBL \\*[cols].
> .write TBL \\*[tabline]
> .write TBL .TE
> .close TBL
> .sy tbl tbltemp > tblouttemp
> .so tblouttemp
> ..
> .Tblone one two three four five twentyfive
> .Tblone eight nine "ten and eleven"
> 
> ==========================================================
> 
> The contents of the file tbltemp after the first call to
> .Tblone are:
> 
> .TS
> allbox tab(#);
> ce le le le le le.
> one#two#three#four#five#twentyfive
> .TE
> 
> and, after the second call:
> 
> .TS
> allbox tab(#);
> ce le le.
> eight#nine#ten and eleven
> .TE
> 
> 
> 
> 
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <address@hidden>
> Fax-to-email: +44 (0)870 094 0861
> Date: 19-May-11                                       Time: 09:14:49
> ------------------------------ XFMail ------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJN1WujAAoJEBi1nVMf5Zz5cecIAJ2scKKahhcR2on3SU4sp6Wt
SxuHi/ATn97k5EsLwdB6kZ2N7LnDSjNviK4dHs0PMG1m0DJ693QwLR23DJFiCOe8
Ho7sGQ64/avun6s5kxUTahBCBjBdYFDSW0iDqTlhPh1+LO+bdBaJxvQh+iE3kvjv
DHUQsAgO0sSzjJ/wI7j3CMFSVT6nmiaReE997+L6g24jKO3CsXOINhQugmdiD1yD
/77wGpqPmexxPjJXqKSJP/qnfGH7cK4rMaES0cP4I4rZtNzeR5pkXyRu47wGEr41
u9y0F2S6Rv4x4ZyBiMl/4rLG5cdG067fQOW/+NQA155mPZkoALLl14PSG9L4aGo=
=G8T+
-----END PGP SIGNATURE-----



reply via email to

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