groff
[Top][All Lists]
Advanced

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

[Groff] Next version of Meta-tbl


From: baruchel
Subject: [Groff] Next version of Meta-tbl
Date: Sun, 6 Aug 2000 16:59:25 +0200
User-agent: Mutt/1.2.5i

Brest, le dimanche 6 août

Hi,

since it's sunday, I'm working hard today...
A few bugs have been fixed. The macros have been tested with in correlation
with Eqn (to put equations inside a table). Now everything seems to work very
fine (except for filling cells on the last line of a 'doublebox').
Tell me if you find other bugs.
You have now a macro to fill a whole col.
===tmac.4t=====================================================
.de M4T \" marks the beginning of the table
\\!# Here starts a new M4T table
\\!m4t: init
.M4Tinitc 1
.M4Tinitl 1
.rr ZZ
.nr M4TLC 0
..
.de M4Tinitc \" remove some registers in case of greater previous table
.if \\n[3cd\\$1] \{\
.                   rr 3cd\\$1
.                   nr ZZ \\$1+1
.                   M4Tinitc \\n(ZZ \}
..
.de M4Tinitl \" remove some registers in case of greater previous table
.if \\n[3rt\\$1] \{\
.                   rr 3rt\\$1
.                   nr ZZ \\$1+1
.                   M4Tinitl \\n(ZZ \}
..
.de M4Tlastc \" looks for the last column
.nr ZZ \\$1+1
.if \\n[3cd\\n(ZZ] \{\
.                     M4Tlastc \\n(ZZ
.                     nr M4TLC +1 \}
..
.de M4Tlastl \" looks for the last line
.nr ZZ \\$1+1
.if \\n[3rt\\n(ZZ] \{\
.                     M4Tlastl \\n(ZZ
.                     nr M4TLL +1 \}
..
.de m4tfc
.mk ZZ
.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]]
.\" Next line seems to fix the bug for the last line of the table
.if !\\n[m4th] .nr m4th \\n(ZZ-\\n[3rt\\n[m4tj]]+.125m
\\!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
.M4Tlastc 0 \" looks for the last column
.M4TfillL \\n[M4TLC] \\$1 \\$2
.rr ZZ
..
.de M4TfillL
.m4tfc \\$1 \\$2 \\$3
.nr ZZ \\$1-1
.if \\n(ZZ .M4TfillL \\n(ZZ \\$2 \\$3
..
.de m4tcf
.M4Tlastl 0 \" looks for the last line
.M4TfillC \\n[M4TLL] \\$1 \\$2
.rr ZZ
..
.de M4TfillC
.m4tfc \\$2 \\$1 \\$3
.nr ZZ \\$1-1
.if \\n(ZZ .M4TfillC \\n(ZZ \\$2 \\$3
..
===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]