groff
[Top][All Lists]
Advanced

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

[Groff] Meta-tbl: a few bugs fixed


From: baruchel
Subject: [Groff] Meta-tbl: a few bugs fixed
Date: Sun, 6 Aug 2000 14:29:15 +0200
User-agent: Mutt/1.2.5i

Brest, le dimanche 6 août

Hi, here is the new version of the program I talked to you about.

A few bugs are now fixed:

  - the 'center' option now works with m4t
    (and indentation for the tables in general should work)
  - the base line of the cell has been changed in order to make
    m4t work with 'allbox' and others. The result is more elegant.

A bug remains: the macros don't work well on the lase line

A new macro : .m4tlf y n
  (fills the line y with gray intensity n)

Try it with this sample file:
___________________________________________
.ps 16
.vs 18
.M4T
.TS
center allbox tab(&);
c c c c.
a&b&c&d
a&b&c&d
a&b&c&d
.TE
.m4tfc 3 2 240
.m4tfc 4 2 240
.m4tlf 1 200
__________________________________

like this:

tbl file | troff -m4t | m4t | grops > file.ps

and now the files (tmac.4t and m4t) : 
===tmac.4t===================================================
.de M4T
\\!m4t: init
..
.de m4tfc
.nr m4ti \\$1-1
.nr m4tj \\$2-1
.nr m4tk \\n[3cd\\n[m4ti]]+\\n[3ind]+\\n(.o
.nr m4tl \\n[3cd\\$1]-\\n[3cd\\n[m4ti]]
.nr m4th \\n[3rt\\$2]-\\n[3rt\\n[m4tj]]
\\!m4t: H\\n[m4tk]
\\!m4t: V\\n[3rt\\n[m4tj]]
.nr m4tk .25m
\\!m4t: v\\n[m4tk]
\\!m4t: Df \\$3 0
\\!m4t: DP \\n[m4tl] 0 0 \\n[m4th] -\\n[m4tl] 0 0 -\\n[m4th]
\\!m4t: Df 0 0
..
.de m4tlf
.nr m4tj \\$1-1
.nr m4tk \\n[3cd0]+\\n[3ind]+\\n(.o
.nr m4th \\n[3rt\\$1]-\\n[3rt\\n[m4tj]]
.nr m4tl \\n(TW
\\!m4t: H\\n[m4tk]
\\!m4t: V\\n[3rt\\n[m4tj]]
.nr m4tk .25m
\\!m4t: v\\n[m4tk]
\\!m4t: Df \\$2 0
\\!m4t: DP \\n[m4tl] 0 0 \\n[m4th] -\\n[m4tl] 0 0 -\\n[m4th]
\\!m4t: Df 0 0
..
===m4t=================================
#!/bin/sh
awk '
BEGIN { m = 0 }
{
  if ((m == 0) && ($1 != "m4t:")) {
    print $0
  }
  if ((m == 1) && ($1 != "m4t:")) {
    n++
    l[n] = $0
  }
  if ((m == 2) && ($1 != "m4t:")) {
    m = 0
    for (i=1; i<=n; i++) {
      print l[i]
    }
    print $0
  }
  if ((m > 0) && ($1 == "m4t:")) {
    m = 2
    gsub("m4t: ","")
    print $0
  }
  if ((m == 0) && ($0 == "m4t: init")) {
    n = 0
    m = 1
  }
}
' $1

reply via email to

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