[Top][All Lists]

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

Re: [Groff] Difference in Groff 1.19

From: Werner LEMBERG
Subject: Re: [Groff] Difference in Groff 1.19
Date: Mon, 01 Dec 2003 08:11:10 +0100 (CET)

> I'm having a problem with groff 1.19 (problem also exists in
> 'current'). I enclose an example which illustrates it.
> Under versions prior to 1.19 the attached file prints 2 lines with a
> number between them, in 1.19 the lines are further apart and the
> number is in the wrong place.
> What this troff snippet does is define a macro which draws the lines
> and the number between.  It then defines a diversion which calls the
> macro and measures the vertical space used.  Finally it outputs this
> diversion to the page.  (It also outputs the macro in top left
> corner for debugging purposes just to prove the macro works
> correctly).

Your macros have a number of flaws:

. *Never* use .PS ... .PE within a macro!  You were lucky that it has
  worked at all.  Instead, use a diversion to save the picture.

. While `."' actually works to start a comment you will get a warning
  that macro `"' isn't defined.  Use `.\"' instead.

. The height of a diversion is directly available in register \n[dn]
  after the diversion has been defined.

. In GNU troff, the unit for the `.ps' request is `z', not `p'.

. `.ss' takes a plain number without a scaling indicator.

Option `-ww' of GNU troff helps to find such problems.

> Both versions of 'pic' generate identical troff code, however the
> 'intermediate' output file (groff -Z) has some differences I don't
> understand, so I think this indicates the change in behaviour is in
> groff itself (not pic or grops).

I don't have time currently to analyze the difference, sorry.  In case
of doubt, the 1.19 behaviour is the correct one :-) Instead, below you
can find a solution which works for me (and which is shorter).



.po 0i
.in 0i
.defcolor GRY00 grey #00
.di PS-div
box ht 0.28 wid 0.79 invis outlined "GRY00"
line colour "GRY00" from .nw of last box to .ne of last box thick 0.8
line colour "GRY00" from .sw of last box to .se of last box thick 0.8
.nr Zh \n[dn]
.\" A macro which outputs 2 lines with a number inbetween
.de BX
.  sp 8.5p
.  mk
.  nf
.  PS-div
.  fi
.  rt
.  sp (\\n[Zh]u / 2u)
.  in +1.05p
.  ll +55.75p
.  ad r
.  ft HB
.  ps 8z
.  ss 8
.  vs 10.4p
.  nop \\m[GRY00]\c
.  nop 6701.62
.  ft
.  vs
.  ps
.  in
.  ll
.sp (5i - \n[Zh]u)
.in 4i
.ll 4i
.sp |0i
.in 0i
.ll 0i

reply via email to

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