9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] regexp metacharacter difficulty inside grap
@ 2010-08-10  5:23 Jeff Sickel
  2010-08-10  8:37 ` Steve Simon
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Jeff Sickel @ 2010-08-10  5:23 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I've been trying to figure out this little one for a while now and figure I could use a refresher course in regexp.

There are quite a few files that I'm trying to copy through grap that would be really easy if I could take a line like:

	# (Yo 4.9534)

and turn it into a value for x,y graphing.  Unfortunately, I'm completely blanking out on how to get that pesky ')' stripped out.  I try the following:

	if "$2" == "(Yo" then {
	 	print sprintf("Yo was %f", yo)
		 yo = sh { echo $3 | sed 's/\)#//' }
		 print sprintf("Yo is %f", yo)
	} 

but that just gives me:

	cpu% eval `{doctype t.g} | lp -dstdout > t.ps
		Yo was 8.579000
	rc: line 2: token ')': syntax error
	grap: syntax error???: No such file or directory
	 near 20100809_pscheck_XX.d:8
	 context is
		yo = sh { echo 4.9534)# | sed 's/\)#//' } >>> <<<


I'm not quite sure why grap converts $3 into "4.9534)#", so I try brute force:

	cpu% echo '4.9534)#' | sed 's/\)#//' 
	4.9534


Does anyone have any hints on what might I be doing wrong in my grap source?

-jas




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

* Re: [9fans] regexp metacharacter difficulty inside grap
  2010-08-10  5:23 [9fans] regexp metacharacter difficulty inside grap Jeff Sickel
@ 2010-08-10  8:37 ` Steve Simon
  2010-08-10  8:54 ` Rudolf Sykora
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 18+ messages in thread
From: Steve Simon @ 2010-08-10  8:37 UTC (permalink / raw)
  To: 9fans

> 	if "$2" == "(Yo" then {
>	 	print sprintf("Yo was %f", yo)
>		 yo = sh { echo $3 | sed 's/\)#//' }
>		 print sprintf("Yo is %f", yo)
>	}

Not sure I get the twists and turns of your shell, which one are you using
as I assume the subtle details are important here - is it bash? also who's grap
is this, is it plan9's or some unix/linux?

My take on the same parsing problem is:

	larch% echo '(Yo 4.9524)' | awk '{print $2+0}'
	4.9524

I don't know if this helps (probably not).

-Steve



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

* Re: [9fans] regexp metacharacter difficulty inside grap
  2010-08-10  5:23 [9fans] regexp metacharacter difficulty inside grap Jeff Sickel
  2010-08-10  8:37 ` Steve Simon
@ 2010-08-10  8:54 ` Rudolf Sykora
  2010-08-10  9:14 ` Rudolf Sykora
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 18+ messages in thread
From: Rudolf Sykora @ 2010-08-10  8:54 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

>                 yo = sh { echo $3 | sed 's/\)#//' }

just thinking...
there might be a differenc between the above and

>        cpu% echo '4.9534)#' | sed 's/\)#//'

thanks to the apostrophes...
if you just write
echo 4.95)
which I think is what happens in the former case, you get the error...
about ')' as you get

Ruda



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

* Re: [9fans] regexp metacharacter difficulty inside grap
  2010-08-10  5:23 [9fans] regexp metacharacter difficulty inside grap Jeff Sickel
  2010-08-10  8:37 ` Steve Simon
  2010-08-10  8:54 ` Rudolf Sykora
@ 2010-08-10  9:14 ` Rudolf Sykora
  2010-08-10 11:45 ` erik quanstrom
  2010-08-10 13:10 ` Federico G. Benavento
  4 siblings, 0 replies; 18+ messages in thread
From: Rudolf Sykora @ 2010-08-10  9:14 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

also, I am afraid that a call like this

>                 yo = sh { echo $3 | sed 's/\)#//' }

is not possible :(.
Although you may call the shell and pass the command to it, I think
you can't get anything easily back, as you want (like you propose by
the assignement 'yo =').

I reckon there is not an easy way how to call another tool (sed,
awk,...) from a grap program and get the result back (other than
through auxiliary files). Correct me someone if I am wrong on this,
please!
That's a pity.

Can't you first run awk on the data and only afterwards run grap on
the distilled result?

Ruda



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

* Re: [9fans] regexp metacharacter difficulty inside grap
  2010-08-10  5:23 [9fans] regexp metacharacter difficulty inside grap Jeff Sickel
                   ` (2 preceding siblings ...)
  2010-08-10  9:14 ` Rudolf Sykora
@ 2010-08-10 11:45 ` erik quanstrom
  2010-08-10 13:06   ` Jeff Sickel
  2010-08-10 13:10 ` Federico G. Benavento
  4 siblings, 1 reply; 18+ messages in thread
From: erik quanstrom @ 2010-08-10 11:45 UTC (permalink / raw)
  To: 9fans

> There are quite a few files that I'm trying to copy through grap that would be really easy if I could take a line like:
>
> 	# (Yo 4.9534)
>
> and turn it into a value for x,y graphing.  Unfortunately, I'm completely blanking out on how to get that pesky ')' stripped out.  I try the following:

why don't you just preprocess the included
files.  ugly, but probablly effective.

- erik



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

* Re: [9fans] regexp metacharacter difficulty inside grap
  2010-08-10 11:45 ` erik quanstrom
@ 2010-08-10 13:06   ` Jeff Sickel
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Sickel @ 2010-08-10 13:06 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs


On Aug 10, 2010, at 6:45 AM, erik quanstrom wrote:

> why don't you just preprocess the included
> files.  ugly, but probablly effective.

pre-processing seems to be the way to go.  Good there there's mk to help set up repeatable processes.




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

* Re: [9fans] regexp metacharacter difficulty inside grap
  2010-08-10  5:23 [9fans] regexp metacharacter difficulty inside grap Jeff Sickel
                   ` (3 preceding siblings ...)
  2010-08-10 11:45 ` erik quanstrom
@ 2010-08-10 13:10 ` Federico G. Benavento
  2010-08-10 13:41   ` Rudolf Sykora
  4 siblings, 1 reply; 18+ messages in thread
From: Federico G. Benavento @ 2010-08-10 13:10 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

this is probably related to the fact that grap(1) is an APE program,
and sh actually execs sh, not rc...

On Tue, Aug 10, 2010 at 2:23 AM, Jeff Sickel <jas@corpus-callosum.com> wrote:
> I've been trying to figure out this little one for a while now and figure I could use a refresher course in regexp.
>
> There are quite a few files that I'm trying to copy through grap that would be really easy if I could take a line like:
>
>        # (Yo 4.9534)
>
> and turn it into a value for x,y graphing.  Unfortunately, I'm completely blanking out on how to get that pesky ')' stripped out.  I try the following:
>
>        if "$2" == "(Yo" then {
>                print sprintf("Yo was %f", yo)
>                 yo = sh { echo $3 | sed 's/\)#//' }
>                 print sprintf("Yo is %f", yo)
>        }
>
> but that just gives me:
>
>        cpu% eval `{doctype t.g} | lp -dstdout > t.ps
>                Yo was 8.579000
>        rc: line 2: token ')': syntax error
>        grap: syntax error???: No such file or directory
>         near 20100809_pscheck_XX.d:8
>         context is
>                yo = sh { echo 4.9534)# | sed 's/\)#//' } >>> <<<
>
>
> I'm not quite sure why grap converts $3 into "4.9534)#", so I try brute force:
>
>        cpu% echo '4.9534)#' | sed 's/\)#//'
>        4.9534
>
>
> Does anyone have any hints on what might I be doing wrong in my grap source?
>
> -jas
>
>
>



-- 
Federico G. Benavento



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

* Re: [9fans] regexp metacharacter difficulty inside grap
  2010-08-10 13:10 ` Federico G. Benavento
@ 2010-08-10 13:41   ` Rudolf Sykora
  2010-08-10 13:58     ` Jeff Sickel
  0 siblings, 1 reply; 18+ messages in thread
From: Rudolf Sykora @ 2010-08-10 13:41 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On 10 August 2010 15:10, Federico G. Benavento <benavento@gmail.com> wrote:
> this is probably related to the fact that grap(1) is an APE program,
> and sh actually execs sh, not rc...

see this line:

>>        rc: line 2: token ')': syntax error

telling that rc is executed. As to why there is the syntax error, as I
wrote couple of hours ago, the reason is that rc tries to execute
/echo 23.45)/ which is syntactically wrong. What is wanted is /echo
'23.45)'/, so that ')' is within aposrophes.

R



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

* Re: [9fans] regexp metacharacter difficulty inside grap
  2010-08-10 13:41   ` Rudolf Sykora
@ 2010-08-10 13:58     ` Jeff Sickel
  2010-08-10 14:11       ` erik quanstrom
  0 siblings, 1 reply; 18+ messages in thread
From: Jeff Sickel @ 2010-08-10 13:58 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

It's good to learn new things every day.  Grap strips the ')' out, no need for all that funny sh {} business:

		if "$1" == "#" then {
			if "$2" == "(Yo" then {
				print sprintf("Yo was %f", yo)
				yo = $3
				print sprintf("Yo is %f", yo)
			}
		}

success!

mk
Creating t.ps...
	Yo was 8.579000
	Yo is 4.953400
	Yo was 4.953400
	Yo is 4.953400
Creating t.pdf...


Now to find out why the fonts on Plan 9 create nice print outs but really awkward text inside of PDF files.  My theory is that gs is not stuffing all of the fonts in as it should.



On Aug 10, 2010, at 8:41 AM, Rudolf Sykora wrote:

> On 10 August 2010 15:10, Federico G. Benavento <benavento@gmail.com> wrote:
>> this is probably related to the fact that grap(1) is an APE program,
>> and sh actually execs sh, not rc...
> 
> see this line:
> 
>>>       rc: line 2: token ')': syntax error
> 
> telling that rc is executed. As to why there is the syntax error, as I
> wrote couple of hours ago, the reason is that rc tries to execute
> /echo 23.45)/ which is syntactically wrong. What is wanted is /echo
> '23.45)'/, so that ')' is within aposrophes.
> 
> R
> 
> 




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

* Re: [9fans] regexp metacharacter difficulty inside grap
  2010-08-10 13:58     ` Jeff Sickel
@ 2010-08-10 14:11       ` erik quanstrom
  2010-08-10 15:52         ` Russ Cox
  0 siblings, 1 reply; 18+ messages in thread
From: erik quanstrom @ 2010-08-10 14:11 UTC (permalink / raw)
  To: 9fans

> Now to find out why the fonts on Plan 9 create nice print outs but really awkward text inside of PDF files.  My theory is that gs is not stuffing all of the fonts in as it should.
>

here are some mk rules that build a proper pdf
that will view nicely on other systems:

%.ps:DQ:	%.ms
	eval `{doctype macros.ms $stem.ms} | \
	lp -m.9 -dstdout >$target

%.pdf:DQ: %.ps
	cat /sys/doc/docfonts $stem.ps >_$stem.ps
	ps2pdf _$stem.ps $stem.pdf && rm -f _$stem.ps

- erik



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

* Re: [9fans] regexp metacharacter difficulty inside grap
  2010-08-10 14:11       ` erik quanstrom
@ 2010-08-10 15:52         ` Russ Cox
  2010-08-11  5:41           ` Jeff Sickel
  2010-08-17  6:07           ` [9fans] iwp9 macros.ms + mkfile, (was--Re: regexp metacharacter difficulty inside grap) Jeff Sickel
  0 siblings, 2 replies; 18+ messages in thread
From: Russ Cox @ 2010-08-10 15:52 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

>        cat /sys/doc/docfonts $stem.ps >_$stem.ps

addpsfonts $stem.ps >_$stem.ps

should do a better job of identifying the necessary fonts.
/sys/doc/docfonts is just the ones used in /sys/doc.

Russ


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

* Re: [9fans] regexp metacharacter difficulty inside grap
  2010-08-10 15:52         ` Russ Cox
@ 2010-08-11  5:41           ` Jeff Sickel
  2010-08-17  6:07           ` [9fans] iwp9 macros.ms + mkfile, (was--Re: regexp metacharacter difficulty inside grap) Jeff Sickel
  1 sibling, 0 replies; 18+ messages in thread
From: Jeff Sickel @ 2010-08-11  5:41 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs


On Aug 10, 2010, at 10:52 AM, Russ Cox wrote:

>>        cat /sys/doc/docfonts $stem.ps >_$stem.ps
> 
> addpsfonts $stem.ps >_$stem.ps
> 
> should do a better job of identifying the necessary fonts.
> /sys/doc/docfonts is just the ones used in /sys/doc.

It may do a better job, but it sure makes my soekris box suffer longer than usual.

For the multi-platform user, I still can't copy/paste text from my PDF afterwards. The PDF looks great other than some Sqrt symbols and some boxes that just don't align compared w/ the Postscript.  There's something about the utf-8/16 encoding that just messes other systems up:


ÿþÿÛ†ÜÿÛÜ \0ÿÛŽÜÿۏÜÿ۝ÜÿۍÜÿÛœÜÿÛ“ÜÿÛŒÜÿÛÜ \0ÿÛ‹Ü \0ÿÛŽÜÿÛ“ÜÿÛ‘ÜÿÛ“ÜÿÛžÜÿÛ‹ÜÿÛ–Ü \0ÿÛžÜÿۏÜÿۍÜÿÛ’ÜÿÛ˜ÜÿÛ“ÜÿÛ›ÜÿÛŸÜÿÛÜ \0ÿېÜÿÛ™ÜÿÛœÜ \0ÿÛžÜÿÛœÜÿÛ‹ÜÿۍÜÿÛ•ÜÿÛ“ÜÿÛ˜ÜÿÛ‘Ü \0ÿÛžÜÿÛ’ÜÿÛÜ \0ÿÛœÜÿۏÜÿ۝ÜÿÛ™ÜÿÛ˜ÜÿÛ‹ÜÿÛ˜ÜÿÛžÜ \0ÿېÜÿÛœÜÿۏÜÿÛ›ÜÿÛŸÜÿۏÜÿÛ˜ÜÿۍÜÿÛ“ÜÿۏÜÿÛÜ \0ÿÛ™ÜÿÛÜ \0ÿÛšÜÿÛ“ÜÿۏÜÿÛ¤ÜÿÛ™ÜÿÛ¥Ü \0ÿۏÜÿÛ–ÜÿۏÜÿۍÜÿÛžÜÿÛœÜÿÛ“ÜÿÛÜ \0ÿÛžÜÿÛœÜÿÛ‹ÜÿÛ˜Üÿ۝ÜÿÛŽÜÿÛŸÜÿۍÜÿۏÜÿÛœÜÿÛÜ \0ÿÛŸÜÿ۝ÜÿۏÜÿÛŽÜ \0ÿÛ“ÜÿÛ˜Ü \0ÿÛŽÜÿÛœÜÿÛ“ÜÿÛ ÜÿÛ“ÜÿÛ˜ÜÿÛ‘Ü \0ÿÛ‹ÜÿÛ˜Ü \0ÿÛ‹ÜÿۏÜÿÛœÜÿÛ™ÜÿÛaÜÿÛ‹ÜÿۍÜÿÛ™ÜÿÛŸÜÿ۝ÜÿÛžÜÿÛ“ÜÿÛÜ \0ÿÛ–ÜÿۏÜÿÛ ÜÿÛ“ÜÿÛžÜÿÛ‹ÜÿÛžÜÿÛ™ÜÿÛœÜÿÛ


or

FF FE FF DB 86 DC FF DB 8F DC 20 00 FF DB 8E DC FF DB 8F DC FF DB 9D DC FF DB 8D DC FF DB 9C DC FF DB 93 DC FF DB 8C DC FF DB 8F DC 20 00 FF DB 8B DC 20 00 FF DB 8E DC FF DB 93 DC FF DB 91 DC FF DB 93 DC FF DB 9E DC FF DB 8B DC FF DB 96 DC 20 00 FF DB 9E DC FF DB 8F DC FF DB 8D DC FF DB 92 DC FF DB 98 DC FF DB 93 DC FF DB 9B DC FF DB 9F DC FF DB 8F DC 20 00 FF DB 90 DC FF DB 99 DC FF DB 9C DC 20 00 FF DB 9E DC FF DB 9C DC FF DB 8B DC FF DB 8D DC FF DB 95 DC FF DB 93 DC FF DB 98 DC FF DB 91 DC 20 00 FF DB 9E DC FF DB 92 DC FF DB 8F DC 20 00 FF DB 9C DC FF DB 8F DC FF DB 9D DC FF DB 99 DC FF DB 98 DC FF DB 8B DC FF DB 98 DC FF DB 9E DC 20 00 FF DB 90 DC FF DB 9C DC FF DB 8F DC FF DB 9B DC FF DB 9F DC FF DB 8F DC FF DB 98 DC FF DB 8D DC FF DB 93 DC FF DB 8F DC FF DB 9D DC 20 00 FF DB 99 DC FF DB 90 DC 20 00 FF DB 9A DC FF DB 93 DC FF DB 8F DC FF DB A4 DC FF DB 99 DC FF DB A5 DC 20 00 FF DB 8F DC FF DB 96 DC FF DB 8F DC FF DB 8D DC FF DB 9E DC FF DB 9C DC FF DB 93 DC FF DB 8D DC 20 00 FF DB 9E DC FF DB 9C DC FF DB 8B DC FF DB 98 DC FF DB 9D DC FF DB 8E DC FF DB 9F DC FF DB 8D DC FF DB 8F DC FF DB 9C DC FF DB 9D DC 20 00 FF DB 9F DC FF DB 9D DC FF DB 8F DC FF DB 8E DC 20 00 FF DB 93 DC FF DB 98 DC 20 00 FF DB 8E DC FF DB 9C DC FF DB 93 DC FF DB A0 DC FF DB 93 DC FF DB 98 DC FF DB 91 DC 20 00 FF DB 8B DC FF DB 98 DC 20 00 FF DB 8B DC FF DB 8F DC FF DB 9C DC FF DB 99 DC FF DB 61 DC FF DB 8B DC FF DB 8D DC FF DB 99 DC FF DB 9F DC FF DB 9D DC FF DB 9E DC FF DB 93 DC FF DB 8D DC 20 00 FF DB 96 DC FF DB 8F DC FF DB A0 DC FF DB 93 DC FF DB 9E DC FF DB 8B DC FF DB 9E DC FF DB 99 DC FF DB 9C DC FF DB


Is all I can get easily.





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

* [9fans] iwp9 macros.ms + mkfile, (was--Re:  regexp metacharacter difficulty inside grap)
  2010-08-10 15:52         ` Russ Cox
  2010-08-11  5:41           ` Jeff Sickel
@ 2010-08-17  6:07           ` Jeff Sickel
  2010-08-17 16:21             ` Russ Cox
  1 sibling, 1 reply; 18+ messages in thread
From: Jeff Sickel @ 2010-08-17  6:07 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Aug 10, 2010, at 10:52 AM, Russ Cox wrote:

>>        cat /sys/doc/docfonts $stem.ps >_$stem.ps
> 
> addpsfonts $stem.ps >_$stem.ps
> 
> should do a better job of identifying the necessary fonts.
> /sys/doc/docfonts is just the ones used in /sys/doc.

Is there a good way to get eqn to use a font other than LucidaSansUnicode?

addpsfonts does add the LucidaSans fonts to the .ps file, but ps2dpf ignores the following:

	LucidaSansUnicode00
	LucidaSansUnicode20
	LucidaSansUnicode22
	LucidaSans-Italic
	LucidaSans-Demi

are all gone in the following does not render well from the PDF:

%!PS-Adobe-2.0
%!PS-AdobeFont-1.1: LucidaSansUnicode20 0.9
...

11 /LucidaSans-Italic f
(V) 1955 7105 w
8 /LucidaSansUnicode00 f
(2) 2044 7127 w
11 /S f
(=) 2121 7105 w
11 /LucidaSans-Italic f
(V) 2200 7105 w
33 /LucidaSansUnicode22 f
(\032) 2276 7204 w
33 /S f
(`) 2543 7204 w
(``) 2614 7204 w
11 /LucidaSans-Italic f
(V) 2579 7182 w
8 /LucidaSans-Italic f
(C) 2668 7204 w
11 /LucidaSansUnicode22 f
(\305) 2740 7182 w
11 /LucidaSans-Italic f
(I) 2799 7182 w
8 /LucidaSans-Italic f
(C) 2844 7204 w
11 /LucidaSans-Italic f
(V) 2583 7017 w
8 /LucidaSansUnicode00 f
(2) 2672 7039 w
11 /LucidaSansUnicode22 f
(\305) 2740 7017 w
11 /LucidaSans-Italic f
(I) 2799 7017 w
8 /LucidaSansUnicode00 f
(2) 2844 7039 w
11 /S1 f
(_) 2563 7072 w
(______) 2594 7072 w
11 /LucidaSansUnicode00 f
(,) 3006 7105 w
11 /LucidaSans-Italic f
(V) 3094 7105 w
8 /LucidaSansUnicode00 f
(2) 3183 7127 w
8 /LucidaSans-Italic f
(C) 3239 7127 w
11 /S f
(=) 3320 7105 w
11 /LucidaSans-Italic f
(V) 3399 7105 w
8 /LucidaSans-Italic f
(C) 3488 7127 w
33 /LucidaSansUnicode22 f
(\032) 3560 7204 w
33 /S f
(`) 3827 7204 w
(``) 3898 7204 w
11 /LucidaSans-Italic f
(V) 3863 7182 w
8 /LucidaSans-Italic f
(C) 3952 7204 w
11 /LucidaSansUnicode22 f
(\305) 4024 7182 w
11 /LucidaSans-Italic f
(I) 4083 7182 w
8 /LucidaSans-Italic f
(C) 4128 7204 w
11 /LucidaSans-Italic f
(V) 3867 7017 w
8 /LucidaSansUnicode00 f
(2) 3956 7039 w
11 /LucidaSansUnicode22 f
(\305) 4024 7017 w
11 /LucidaSans-Italic f
(I) 4083 7017 w
8 /LucidaSansUnicode00 f
(2) 4128 7039 w
11 /S1 f
(_) 3847 7072 w
(______) 3878 7072 w

...
%%Trailer
done
%%DocumentFonts: LucidaSansUnicode20 LucidaSansUnicode21 LucidaSansUnicode22 LucidaSansUnicode25 S1 S LucidaSansUnicode00 LucidaSans-Demi LucidaSans-Italic LucidaTypewriter






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

* Re: [9fans] iwp9 macros.ms + mkfile, (was--Re: regexp metacharacter difficulty inside grap)
  2010-08-17  6:07           ` [9fans] iwp9 macros.ms + mkfile, (was--Re: regexp metacharacter difficulty inside grap) Jeff Sickel
@ 2010-08-17 16:21             ` Russ Cox
  2010-08-18  1:28               ` Jeff Sickel
  0 siblings, 1 reply; 18+ messages in thread
From: Russ Cox @ 2010-08-17 16:21 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Mon, Aug 16, 2010 at 11:07 PM, Jeff Sickel <jas@corpus-callosum.com> wrote:
> On Aug 10, 2010, at 10:52 AM, Russ Cox wrote:
>
>>>        cat /sys/doc/docfonts $stem.ps >_$stem.ps
>>
>> addpsfonts $stem.ps >_$stem.ps
>>
>> should do a better job of identifying the necessary fonts.
>> /sys/doc/docfonts is just the ones used in /sys/doc.
>
> Is there a good way to get eqn to use a font other than LucidaSansUnicode?

If you typeset the document in Times instead of Lucida, you can add:

.fp 1 R R.nomath

and then troff should fall back to the math symbols in the standard
PostScript Symbol font.

Russ


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

* Re: [9fans] iwp9 macros.ms + mkfile, (was--Re: regexp metacharacter difficulty inside grap)
  2010-08-17 16:21             ` Russ Cox
@ 2010-08-18  1:28               ` Jeff Sickel
  2010-08-18  1:59                 ` Russ Cox
  0 siblings, 1 reply; 18+ messages in thread
From: Jeff Sickel @ 2010-08-18  1:28 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs


On Aug 17, 2010, at 11:21 AM, Russ Cox wrote:

>> Is there a good way to get eqn to use a font other than LucidaSansUnicode?
> 
> If you typeset the document in Times instead of Lucida, you can add:
> 
> .fp 1 R R.nomath
> 
> and then troff should fall back to the math symbols in the standard
> PostScript Symbol font.

That kind of helps.  After looking at Lucida Sans Unicode for so long though, I find Times a bit odd.  It also doesn't seem to help with eqn right '[' or '{' and left ']' or '}' when converted to PDF.

Postscript is fine, I'll just ignore the proliferation of PDF until I've got time to dig in and look more deeply into eqn and the ghostscript sources.

-jas




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

* Re: [9fans] iwp9 macros.ms + mkfile, (was--Re: regexp metacharacter difficulty inside grap)
  2010-08-18  1:28               ` Jeff Sickel
@ 2010-08-18  1:59                 ` Russ Cox
  2010-08-20 14:58                   ` Jeff Sickel
  0 siblings, 1 reply; 18+ messages in thread
From: Russ Cox @ 2010-08-18  1:59 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> Postscript is fine, I'll just ignore the proliferation
> of PDF until I've got time to dig in and look more
> deeply into eqn and the ghostscript sources.

It's almost certainly that addpsfonts isn't adding
the right ps fonts.  I've never seen a problem with
ps2pdf misbehaving when it has all the right fonts.

Russ


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

* Re: [9fans] iwp9 macros.ms + mkfile, (was--Re: regexp metacharacter difficulty inside grap)
  2010-08-18  1:59                 ` Russ Cox
@ 2010-08-20 14:58                   ` Jeff Sickel
  2010-08-21  2:22                     ` Russ Cox
  0 siblings, 1 reply; 18+ messages in thread
From: Jeff Sickel @ 2010-08-20 14:58 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Aug 17, 2010, at 8:59 PM, Russ Cox wrote:

>> Postscript is fine, I'll just ignore the proliferation
>> of PDF until I've got time to dig in and look more
>> deeply into eqn and the ghostscript sources.
> 
> It's almost certainly that addpsfonts isn't adding
> the right ps fonts.  I've never seen a problem with
> ps2pdf misbehaving when it has all the right fonts.

Thanks for the pointers Russ.

Symbols look great on Plan 9's page when you're looking at the .ps file.  It's the ps2pdf conversion that botches it as can also be seen by looking at this small example:

.NH
Test
.PP
.EQ
p = sqrt{{P sub ac Z} over A}
.EN


All of the Lucida fonts are included in the .ps.  I'm starting to think that the mapping for S and S1 are the actual problems, but only when going through the ps2pdf conversion.  The radical and radicalex settings do get thrown off.  S is also the problem for the left [ and right ] creation:

	11 /S f (\351) 2941 1172 w
	(\357) 2941 1282 w
	(\353) 2941 1392 w 


See the following from a .ps file:


%
% A few arrays used to adjust reference points and character widths in some
% of the printer resident fonts. If square roots are too high try changing
% the lines describing /radical and /radicalex to,
%
%	/radical	[0 -75 550 0]
%	/radicalex	[-50 -75 500 0]
%
% Move braceleftbt a bit - default PostScript character is off a bit.
%

/Sdefs [
	/bracketlefttp		[201 500]
	/bracketleftbt		[201 500]
	/bracketrighttp		[-81 380]
	/bracketrightbt		[-83 380]
	/braceleftbt		[203 490]
	/bracketrightex		[220 -125 500 0]
	/radical		[0 0 550 0]
	/radicalex		[-50 0 500 0]
	/parenleftex		[-20 -170 0 0]
	/integral		[100 -50 500 0]
	/infinity		[10 -75 730 0]
] def

/S1defs [
	/underscore		[0 80 500 0]
	/endash			[7 90 650 0]
] def



With a little experimentation, it will be possible to add an additional preprocessor to scrub the .ps file before converting to pdf.

-jas




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

* Re: [9fans] iwp9 macros.ms + mkfile, (was--Re: regexp metacharacter difficulty inside grap)
  2010-08-20 14:58                   ` Jeff Sickel
@ 2010-08-21  2:22                     ` Russ Cox
  0 siblings, 0 replies; 18+ messages in thread
From: Russ Cox @ 2010-08-21  2:22 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I don't have a Plan 9 system so I can't look at what you're seeing.
Maybe you could post the PS and PDF somewhere?

It sounds like perhaps you're worrying about the exact spacing
of the math symbols not lining up properly.  That's almost certainly
true: zoomed in screens are much less forgiving than the printers
that eqn was using.

Russ


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

end of thread, other threads:[~2010-08-21  2:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-10  5:23 [9fans] regexp metacharacter difficulty inside grap Jeff Sickel
2010-08-10  8:37 ` Steve Simon
2010-08-10  8:54 ` Rudolf Sykora
2010-08-10  9:14 ` Rudolf Sykora
2010-08-10 11:45 ` erik quanstrom
2010-08-10 13:06   ` Jeff Sickel
2010-08-10 13:10 ` Federico G. Benavento
2010-08-10 13:41   ` Rudolf Sykora
2010-08-10 13:58     ` Jeff Sickel
2010-08-10 14:11       ` erik quanstrom
2010-08-10 15:52         ` Russ Cox
2010-08-11  5:41           ` Jeff Sickel
2010-08-17  6:07           ` [9fans] iwp9 macros.ms + mkfile, (was--Re: regexp metacharacter difficulty inside grap) Jeff Sickel
2010-08-17 16:21             ` Russ Cox
2010-08-18  1:28               ` Jeff Sickel
2010-08-18  1:59                 ` Russ Cox
2010-08-20 14:58                   ` Jeff Sickel
2010-08-21  2:22                     ` Russ Cox

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).