9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] where to get color troff?
@ 2011-04-12  6:09 Fernan Bolando
  2011-04-12  6:38 ` Peter A. Cejchan
  0 siblings, 1 reply; 9+ messages in thread
From: Fernan Bolando @ 2011-04-12  6:09 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 236 bytes --]

Hi all

what are our plan9 option for making colored graphs for troff documents?
I am guessing this how it's going to be done

create graph using pure postscript -> troff -mpictures -> page

is there any other option?

fernan

[-- Attachment #2: Type: text/html, Size: 270 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] where to get color troff?
  2011-04-12  6:09 [9fans] where to get color troff? Fernan Bolando
@ 2011-04-12  6:38 ` Peter A. Cejchan
  2011-04-12  7:16   ` Fernan Bolando
  0 siblings, 1 reply; 9+ messages in thread
From: Peter A. Cejchan @ 2011-04-12  6:38 UTC (permalink / raw)
  To: fernanbolando, Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 42 bytes --]

do you mean 'graph', or 'chart' ?
++pac

[-- Attachment #2: Type: text/html, Size: 69 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] where to get color troff?
  2011-04-12  6:38 ` Peter A. Cejchan
@ 2011-04-12  7:16   ` Fernan Bolando
  2011-04-12  7:33     ` Sape Mullender
  0 siblings, 1 reply; 9+ messages in thread
From: Fernan Bolando @ 2011-04-12  7:16 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 162 bytes --]

On Tue, Apr 12, 2011 at 2:38 PM, Peter A. Cejchan <tyapca7@gmail.com> wrote:

> do you mean 'graph', or 'chart' ?
> ++pac
>

right now it's mostly charts.

[-- Attachment #2: Type: text/html, Size: 444 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] where to get color troff?
  2011-04-12  7:16   ` Fernan Bolando
@ 2011-04-12  7:33     ` Sape Mullender
  2011-04-12  8:24       ` Fernan Bolando
  2011-05-14  0:43       ` Jeff Sickel
  0 siblings, 2 replies; 9+ messages in thread
From: Sape Mullender @ 2011-04-12  7:33 UTC (permalink / raw)
  To: fernanbolando, 9fans

> On Tue, Apr 12, 2011 at 2:38 PM, Peter A. Cejchan <tyapca7@gmail.com> wrote:
>
>> do you mean 'graph', or 'chart' ?
>> ++pac
>>
>
> right now it's mostly charts.

I use these macros for generating color:

.de CL
\\X'PS \\$1 \\$2 \\$3 setrgbcolor'\\c
..
.de BK
\\X'PS 0 0 0 setrgbcolor'\\c
..
.de EM
\\$3\\X'PS 1 0 0 setrgbcolor'\\$1\\X'PS 0 0 0 setrgbcolor'\\$2
..

They only work if you generate postscript (you can, of course, turn that
into pdf as well).
.CL r g b
sets the color to the rgb values (0 0 0 being black, 1 1 1 being white,
0.5 0.5 0.5 being middle grey)
.BK
sets the color to black.
.EM "string1" "string2" "string3"
(emphasis), where strings 2 and 3 are optional prints string3 in the current
color, followed by string1 in red and string2 in black (with no space between
strings 3, 1 and 2 — they work as .B or .I in the .ms macro package.

	Sape




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] where to get color troff?
  2011-04-12  7:33     ` Sape Mullender
@ 2011-04-12  8:24       ` Fernan Bolando
  2011-04-12 12:31         ` pmarin
  2011-05-14  0:43       ` Jeff Sickel
  1 sibling, 1 reply; 9+ messages in thread
From: Fernan Bolando @ 2011-04-12  8:24 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 1101 bytes --]

On Tue, Apr 12, 2011 at 3:33 PM, Sape Mullender <sape@plan9.bell-labs.com>wrote:

> > On Tue, Apr 12, 2011 at 2:38 PM, Peter A. Cejchan <tyapca7@gmail.com>
> wrote:
> >
> >> do you mean 'graph', or 'chart' ?
> >> ++pac
> >>
> >
> > right now it's mostly charts.
>
> I use these macros for generating color:
>
> .de CL
> \\X'PS \\$1 \\$2 \\$3 setrgbcolor'\\c
> ..
> .de BK
> \\X'PS 0 0 0 setrgbcolor'\\c
> ..
> .de EM
> \\$3\\X'PS 1 0 0 setrgbcolor'\\$1\\X'PS 0 0 0 setrgbcolor'\\$2
> ..
>
> They only work if you generate postscript (you can, of course, turn that
> into pdf as well).
> .CL r g b
> sets the color to the rgb values (0 0 0 being black, 1 1 1 being white,
> 0.5 0.5 0.5 being middle grey)
> .BK
> sets the color to black.
> .EM "string1" "string2" "string3"
> (emphasis), where strings 2 and 3 are optional prints string3 in the
> current
> color, followed by string1 in red and string2 in black (with no space
> between
> strings 3, 1 and 2 — they work as .B or .I in the .ms macro package.
>
>        Sape
>
>
Wow cool it worked. thanks a lot

[-- Attachment #2: Type: text/html, Size: 1668 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] where to get color troff?
  2011-04-12  8:24       ` Fernan Bolando
@ 2011-04-12 12:31         ` pmarin
  0 siblings, 0 replies; 9+ messages in thread
From: pmarin @ 2011-04-12 12:31 UTC (permalink / raw)
  To: fernanbolando, Fans of the OS Plan 9 from Bell Labs

/sys/src/cmd/postscript/mcolor/

On Tue, Apr 12, 2011 at 10:24 AM, Fernan Bolando
<fernanbolando@mailc.net> wrote:
>
>
> On Tue, Apr 12, 2011 at 3:33 PM, Sape Mullender <sape@plan9.bell-labs.com>
> wrote:
>>
>> > On Tue, Apr 12, 2011 at 2:38 PM, Peter A. Cejchan <tyapca7@gmail.com>
>> > wrote:
>> >
>> >> do you mean 'graph', or 'chart' ?
>> >> ++pac
>> >>
>> >
>> > right now it's mostly charts.
>>
>> I use these macros for generating color:
>>
>> .de CL
>> \\X'PS \\$1 \\$2 \\$3 setrgbcolor'\\c
>> ..
>> .de BK
>> \\X'PS 0 0 0 setrgbcolor'\\c
>> ..
>> .de EM
>> \\$3\\X'PS 1 0 0 setrgbcolor'\\$1\\X'PS 0 0 0 setrgbcolor'\\$2
>> ..
>>
>> They only work if you generate postscript (you can, of course, turn that
>> into pdf as well).
>> .CL r g b
>> sets the color to the rgb values (0 0 0 being black, 1 1 1 being white,
>> 0.5 0.5 0.5 being middle grey)
>> .BK
>> sets the color to black.
>> .EM "string1" "string2" "string3"
>> (emphasis), where strings 2 and 3 are optional prints string3 in the
>> current
>> color, followed by string1 in red and string2 in black (with no space
>> between
>> strings 3, 1 and 2 — they work as .B or .I in the .ms macro package.
>>
>>        Sape
>>
>
> Wow cool it worked. thanks a lot
>
>
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] where to get color troff?
  2011-04-12  7:33     ` Sape Mullender
  2011-04-12  8:24       ` Fernan Bolando
@ 2011-05-14  0:43       ` Jeff Sickel
  2011-05-16 13:36         ` Russ Cox
  1 sibling, 1 reply; 9+ messages in thread
From: Jeff Sickel @ 2011-05-14  0:43 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs


On Apr 12, 2011, at 2:33 AM, Sape Mullender wrote:

> I use these macros for generating color:

They work great for troff, now I just need to investigate applying the same technique to grap.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] where to get color troff?
  2011-05-14  0:43       ` Jeff Sickel
@ 2011-05-16 13:36         ` Russ Cox
  2011-05-16 14:56           ` Jeff Sickel
  0 siblings, 1 reply; 9+ messages in thread
From: Russ Cox @ 2011-05-16 13:36 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> They work great for troff, now I just need to investigate applying the same technique to grap.

You can do it in pic (and I think grap) by just emitting some text
before drawing something.  In fact you can do arbitrary postscript
code.  This snippet uses the Pr string to push the current color
on the stack and then switch to gray.  The Pb string restores the
previous color from the stack.


.de XX
\\X'\\$1'
.br
.sp -1
..
.ie \n(yr>=100 .ds Ps "ps: exec
.el .ds Ps PS
.ds Pr "\*(Ps currentrgbcolor 0.75 0.75 0.75 setrgbcolor
.ds Pb "\*(Ps setrgbcolor

.G1
frame ht 1.5 wid 4 top invis right invis
label bot "Time"
label left "Goodput"
ticks left out at 0 "0", 1000000 "1Mbps"
.XX "\*(Pr
copy "/tmp/6.829/FQCBR:net0-stput-0.dat!" thru / next at $1,$2 /
new solid
.XX "\*(Pb
copy "/tmp/6.829/FQCBR:net0-stput-1.dat!" thru / next at $1,$2 /
new solid
copy "/tmp/6.829/FQCBR:net0-stput-2.dat!" thru / next at $1,$2 /
.G2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] where to get color troff?
  2011-05-16 13:36         ` Russ Cox
@ 2011-05-16 14:56           ` Jeff Sickel
  0 siblings, 0 replies; 9+ messages in thread
From: Jeff Sickel @ 2011-05-16 14:56 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs


On May 16, 2011, at 8:36 AM, Russ Cox wrote:

>> They work great for troff, now I just need to investigate applying the same technique to grap.
> 
> You can do it in pic (and I think grap) by just emitting some text
> before drawing something.  In fact you can do arbitrary postscript
> code.  This snippet uses the Pr string to push the current color
> on the stack and then switch to gray.  The Pb string restores the
> previous color from the stack.

Thanks, that made me look back at the docks (and Sape's original
post) and remember that the emitted text needs to be
.at the beginning of the line.




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-05-16 14:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-12  6:09 [9fans] where to get color troff? Fernan Bolando
2011-04-12  6:38 ` Peter A. Cejchan
2011-04-12  7:16   ` Fernan Bolando
2011-04-12  7:33     ` Sape Mullender
2011-04-12  8:24       ` Fernan Bolando
2011-04-12 12:31         ` pmarin
2011-05-14  0:43       ` Jeff Sickel
2011-05-16 13:36         ` Russ Cox
2011-05-16 14:56           ` Jeff Sickel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).