Re: pic doesn't center when i use a macro

2021-11-04 Thread Marc Chantreux
> 1) wrapped the what_should_become_a_string inside a custom object []. > (See the braces of the macro.) This makes the 'if' statements (and > more) possible. > 2) I placed those object directly, as you can do with any graphic object > (incl. strings) in pic. Annotation labels are way limited. Whe

Re: pic doesn't center when i use a macro

2021-11-04 Thread Holger Herrlich
I did three things: 1) wrapped the what_should_become_a_string inside a custom object []. (See the braces of the macro.) This makes the 'if' statements (and more) possible. 2) I placed those object directly, as you can do with any graphic object (incl. strings) in pic. Annotation labels are way

Re: pic doesn't center when i use a macro

2021-11-04 Thread Marc Chantreux
hello Holger, > box width w height margin with .nw at last box .nw dashed > label_for(layer) at last box.c I really don't know why but yes: it works. Now i have a workaround in my hand. On the other hand: the more i saw the Tadziu's code, the more I like it for its clean separation betwe

Re: pic doesn't center when i use a macro

2021-11-03 Thread Holger Herrlich
.PS define label_for {[ if $1 == 0 then { "Entête Ethernet" } else { if $1 == 1 then { "Entête IP"} else { if $1 == 2 then { "Entête TCP" } else { if $1 == 3 then { "Donnees applicatives" } else { } } } } ]} w = 3 ; h = 2; margin = .2 ; tr = 2 * ma

Re: pic doesn't center when i use a macro

2021-11-02 Thread Marc Chantreux
hello Douglas, > Remember that macros work by substitution. So each line of label_for > becomes a separate line in the macro-expanded program. A label alone > on a line gets plotted at the current point, which in this case is > last box.e. That, with the explainations from Tadziu, helped a lot. T

Re: pic doesn't center when i use a macro

2021-11-01 Thread Douglas McIlroy
Remember that macros work by substitution. So each line of label_for becomes a separate line in the macro-expanded program. A label alone on a line gets plotted at the current point, which in this case is last box.e. (The macro definition begins with an empty line. If it didn't, then the case-0 li

Re: pic doesn't center when i use a macro

2021-11-01 Thread Tadziu Hoffmann
> I can do something more manual but i really would like to take advantage > of the expressivity of pic. Any other comment is also warmly welcome. It looks like pic has no string variables, and the "if" works at the statement level, not expression level. To provide a somewhat constructive answe

Re: pic doesn't center when i use a macro

2021-11-01 Thread Marc Chantreux
Le Mon, Nov 01, 2021 at 04:12:46PM -0400, T. Kurt Bond a écrit : > While I don't have any suggestions as how to fix this, I did try it with > Heirloom troff, and it seems to have the same unwanted non-centering result > as groff. thanks a lot for confirming. i guess the next step would be to gdb p

Re: pic doesn't center when i use a macro

2021-11-01 Thread T. Kurt Bond
While I don't have any suggestions as how to fix this, I did try it with Heirloom troff, and it seems to have the same unwanted non-centering result as groff. On Mon, Nov 1, 2021 at 3:52 PM Marc Chantreux wrote: > hello groffers, > > I wrote the following code to illustrate the DOD model encapsu

pic doesn't center when i use a macro

2021-11-01 Thread Marc Chantreux
hello groffers, I wrote the following code to illustrate the DOD model encapsulation. sadly: the label of the layers are not centred. it seems to be relative to the fact i use a function as it works fine when i replace label_for(layer) by a simple string like box width w height margin \