* Context and PSTricks
@ 2002-03-11 18:33 John Culleton
2002-03-11 22:56 ` Hans Hagen
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: John Culleton @ 2002-03-11 18:33 UTC (permalink / raw)
Context in its present form cannot handle Pstricks because
Pstricks generate Postscript code that is a bit scary when
inserted in a pdf file. (I have heard of Postscript embedded
in PDF but I would not want to count on it.) However
Metapost code is handled by an on-the-fly call to the
mpost program. I wonder if the same principle could be
used for incorporating Pstricks figures and special
effects into Context?
Pstricks is more directly concerned with e.g. graphs,
tree diagrams, etc. and has many useful commands. Before
being lured by pdftex and Context it was a standard part
of my vocabulary.
John Culleton
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Context and PSTricks
2002-03-11 18:33 Context and PSTricks John Culleton
@ 2002-03-11 22:56 ` Hans Hagen
2002-03-12 7:57 ` Eckhart Guthöhrlein
2002-03-12 9:19 ` Taco Hoekwater
2 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2002-03-11 22:56 UTC (permalink / raw)
Cc: ntg-context
At 01:33 PM 3/11/2002 -0500, John Culleton wrote:
>Context in its present form cannot handle Pstricks because
>Pstricks generate Postscript code that is a bit scary when
>inserted in a pdf file. (I have heard of Postscript embedded
>in PDF but I would not want to count on it.) However
>Metapost code is handled by an on-the-fly call to the
>mpost program. I wonder if the same principle could be
>used for incorporating Pstricks figures and special
>effects into Context?
>
>Pstricks is more directly concerned with e.g. graphs,
>tree diagrams, etc. and has many useful commands. Before
>being lured by pdftex and Context it was a standard part
>of my vocabulary.
So you want to pipe the graphic to an external app?
\starttext
\startbuffer[pst]
\startTEXpage
\usemodule[pstrick]
\pspicture(0,0)(10,10)
\dorecurse{10}{\psline(0,0)(10,\recurselevel)}
\dorecurse{10}{\psline(\recurselevel,0)(100,100)}
\endpspicture
\stopTEXpage
\stopbuffer
\immediate\write18{texexec \bufferprefix pst.tmp --once --batch}
\immediate\write18{dvips \bufferprefix pst}
\immediate\write18{ps2pdf \bufferprefix pst.ps \bufferprefix pst.pdf}
\externalfigure[\bufferprefix pst.pdf]
\stoptext
say that this is file test.tex, then "texexec --pdf test" should work
(given that write 18 is enabled);
Now, the problem is to get the right boundingbox; collecting the picts in a
file is also not that hard, so if you don't care about real trickery, this
is as way.
Now, let's wrap that in a decent macro:
% interface=en output=pdftex
\starttext
\unprotected \long\def\startPSTRICKS#1\stopPSTRICKS
{\bgroup
\setbuffer[pstrick]%
\usemodule[pstrick]%
\setbox\scratchbox=\hbox{#1}%
\immediate\openout\scratchwrite=\bufferprefix dim.tmp
\immediate\write\scratchwrite{\dimen0=\the\ht\scratchbox}%
\immediate\write\scratchwrite{\dimen2=\the\wd\scratchbox}%
\immediate\closeout\scratchwrite
\startTEXpage
\box\scratchbox
\stopTEXpage
\endbuffer
\immediate\write18{texexec \bufferprefix pstrick.tmp --once --batch}%
\immediate\write18{dvips \bufferprefix pstrick}%
\immediate\write18{ps2pdf \bufferprefix pstrick.ps \bufferprefix
pstrick.pdf}%
\readlocfile{\bufferprefix pstrick-dim.tmp}{}{}%
\setbox\scratchbox=\hbox
{\externalfigure[\bufferprefix pstrick.pdf][\c!object=\v!nee]}%
\setbox\scratchbox=\hbox
{\lower\ht\scratchbox\hbox{\raise\dimen2\box\scratchbox}}%
\wd\scratchbox\dimen0
\ht\scratchbox\dimen2
\dp\scratchbox\zeropoint
\box\scratchbox
\egroup}
\ruledhbox{\startPSTRICKS
\pspicture(0,0)(10,10)
\dorecurse{10}{\psline(0,0)(\recurselevel,10)}
\dorecurse{10}{\psline(0,0)(10,\recurselevel)}
\endpspicture
\stopPSTRICKS}
\stoptext
I will add the startPSTRICKS (actually a sligthly better version that is
less sensitive for input and that adapts itself to dvi/pdf) macro to
m-pstrick and send you the file,
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | pragma@wxs.nl
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
fall-back web server:
www.pragma-ade.nl
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Context and PSTricks
2002-03-11 18:33 Context and PSTricks John Culleton
2002-03-11 22:56 ` Hans Hagen
@ 2002-03-12 7:57 ` Eckhart Guthöhrlein
2002-03-12 9:19 ` Taco Hoekwater
2 siblings, 0 replies; 7+ messages in thread
From: Eckhart Guthöhrlein @ 2002-03-12 7:57 UTC (permalink / raw)
Cc: ntg-context
John Culleton wrote:
> Pstricks is more directly concerned with e.g. graphs,
> tree diagrams, etc. and has many useful commands. Before
> being lured by pdftex and Context it was a standard part
> of my vocabulary.
I have created some graphs and tree diagrams with the metaobj package
for metapost. It tries to provide many of pstricks' features. If you
don't already know about it, you will surely want to have a look at it.
Eckhart
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Context and PSTricks
2002-03-11 18:33 Context and PSTricks John Culleton
2002-03-11 22:56 ` Hans Hagen
2002-03-12 7:57 ` Eckhart Guthöhrlein
@ 2002-03-12 9:19 ` Taco Hoekwater
2002-03-12 12:12 ` Hans Hagen
2 siblings, 1 reply; 7+ messages in thread
From: Taco Hoekwater @ 2002-03-12 9:19 UTC (permalink / raw)
Cc: ntg-context
On Mon, 11 Mar 2002 13:33:46 -0500
"John Culleton" <john@wexfordpress.com> wrote:
>
> Context in its present form cannot handle Pstricks because
> Pstricks generate Postscript code that is a bit scary when
> inserted in a pdf file. (I have heard of Postscript embedded
> in PDF but I would not want to count on it.) However
> Metapost code is handled by an on-the-fly call to the
> mpost program. I wonder if the same principle could be
> used for incorporating Pstricks figures and special
> effects into Context?
Well, maybe (really, maybe) it is possible to feed some of the
pstricks ps output to ps2edit (assuming you glue the correct
headers in front of it). But not all of it, since sometimes
pstricks *really* does tricks that depend on contextual information
that is not longer present in the pdf or dvi version of a document,
only in the dvips-generated PostScript version.
And even if you are happy with the partial solution this approach
offers, you would still need to write a driver for the ps2edit output.
The easier way out (though still a lot of work) is to re-implement
the pstricks interface using metapost and ConTeXt commands. I am
not volunteering for that one, either. It's just too much work.
--
groeten,
Taco
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Context and PSTricks
2002-03-12 9:19 ` Taco Hoekwater
@ 2002-03-12 12:12 ` Hans Hagen
2002-04-02 16:56 ` John Culleton
0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2002-03-12 12:12 UTC (permalink / raw)
Cc: john, ntg-context
At 10:19 AM 3/12/2002 +0100, Taco Hoekwater wrote:
>On Mon, 11 Mar 2002 13:33:46 -0500
>"John Culleton" <john@wexfordpress.com> wrote:
>
> >
> > Context in its present form cannot handle Pstricks because
> > Pstricks generate Postscript code that is a bit scary when
> > inserted in a pdf file. (I have heard of Postscript embedded
> > in PDF but I would not want to count on it.) However
> > Metapost code is handled by an on-the-fly call to the
> > mpost program. I wonder if the same principle could be
> > used for incorporating Pstricks figures and special
> > effects into Context?
>
>Well, maybe (really, maybe) it is possible to feed some of the
>pstricks ps output to ps2edit (assuming you glue the correct
>headers in front of it). But not all of it, since sometimes
>pstricks *really* does tricks that depend on contextual information
>that is not longer present in the pdf or dvi version of a document,
>only in the dvips-generated PostScript version.
>
>And even if you are happy with the partial solution this approach
>offers, you would still need to write a driver for the ps2edit output.
>
>The easier way out (though still a lot of work) is to re-implement
>the pstricks interface using metapost and ConTeXt commands. I am
>not volunteering for that one, either. It's just too much work.
The new beta provides:
\usemodule[pstric]
\startPSTRICKS
some reasonable trickery (don't know pstricks goog enough to provide
samples)
\stopPSTRICKS
it assumes that you have gs installed and write 18 enabled
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | pragma@wxs.nl
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
fall-back web server:
www.pragma-ade.nl
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Context and PSTricks
2002-03-12 12:12 ` Hans Hagen
@ 2002-04-02 16:56 ` John Culleton
2002-04-02 18:13 ` W. Egger
0 siblings, 1 reply; 7+ messages in thread
From: John Culleton @ 2002-04-02 16:56 UTC (permalink / raw)
Cc: john, ntg-context
On Tuesday 12 March 2002 07:12, Hans Hagen wrote:
> At 10:19 AM 3/12/2002 +0100, Taco Hoekwater wrote:
> >On Mon, 11 Mar 2002 13:33:46 -0500
> >
> >"John Culleton" <john@wexfordpress.com> wrote:
> > > Context in its present form cannot handle Pstricks because
(snip)
>> The new beta provides:
>
> \usemodule[pstric]
>
> \startPSTRICKS
> some reasonable trickery (don't know pstricks goog enough to
> provide samples)
> \stopPSTRICKS
>
> it assumes that you have gs installed and write 18 enabled
>
> Hans
>
OK I have gs installed. Do I need to say something like
\openout18? If so what is what name do I assign to 18?
Does pdftex handle this high a number? I get a message
that says
-------------------------------------------------
pstricks : using indirect method; enable write18
--------------------------------------------
I tried the above code with a very simple PSTRICK, a word of text in
a circle.
I get this kind of error:
--------------------------------
! Undefined control sequence.
<argument> \startTEXapplication
[]{\usemodule [pstric]}\pspicture
(0,0)(10,0...
\secondoftwoarguments #1#2->#2
l.71 \stopPSTRICKS
----------------------------
This message persists even if I just say \startPSTRICKS and
\stopPSTRICKS.
My version is
----------------------------------
TeXExec 2.6 - ConTeXt / PRAGMA ADE 1997-2001
executable : pdfetex
format : cont-en
inputfile : freec
output : pdftex
interface : en
current mode : all
TeX run : 1
This is pdfeTeX, Version 3.14159-13d-2.1 (Web2C 7.3.1)
entering extended mode
(freec.tex[/usr/share/texmf/pdftex/config/pdftex.cfg]
ConTeXt ver: 2001.11.13 fmt: 2002.3.28 int: english mes: english
-------------------------------
Is this what I should see?
Sorry to be such a bother!
John Culleton
__________________________________________________
D O T E A S Y - "Join the web hosting revolution!"
http://www.doteasy.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Context and PSTricks
2002-04-02 16:56 ` John Culleton
@ 2002-04-02 18:13 ` W. Egger
0 siblings, 0 replies; 7+ messages in thread
From: W. Egger @ 2002-04-02 18:13 UTC (permalink / raw)
Cc: ntg-context
Hi John,
It looks likely, that you did not enable write18.
Edit the file texmf.cnf, set the shell-escape to true (Take care, there
might be more than one file with this name in your tex-tree):
% Enable system commands via \write18{...}?
shell_escape = t
I hope this helps
Willi
----- Original Message -----
From: John Culleton <john@wexfordpress.com>
To: Hans Hagen <pragma@wxs.nl>; Taco Hoekwater <taco@elvenkind.com>
Cc: <john@wexfordpress.com>; <ntg-context@let.uu.nl>
Sent: Tuesday, April 02, 2002 6:56 PM
Subject: Re: Context and PSTricks
> On Tuesday 12 March 2002 07:12, Hans Hagen wrote:
> > At 10:19 AM 3/12/2002 +0100, Taco Hoekwater wrote:
> > >On Mon, 11 Mar 2002 13:33:46 -0500
> > >
> > >"John Culleton" <john@wexfordpress.com> wrote:
> > > > Context in its present form cannot handle Pstricks because
> (snip)
> >> The new beta provides:
> >
> > \usemodule[pstric]
> >
> > \startPSTRICKS
> > some reasonable trickery (don't know pstricks goog enough to
> > provide samples)
> > \stopPSTRICKS
> >
> > it assumes that you have gs installed and write 18 enabled
> >
> > Hans
> >
> OK I have gs installed. Do I need to say something like
> \openout18? If so what is what name do I assign to 18?
> Does pdftex handle this high a number? I get a message
> that says
> -------------------------------------------------
> pstricks : using indirect method; enable write18
> --------------------------------------------
>
> I tried the above code with a very simple PSTRICK, a word of text in
> a circle.
>
> I get this kind of error:
> --------------------------------
> ! Undefined control sequence.
> <argument> \startTEXapplication
> []{\usemodule [pstric]}\pspicture
> (0,0)(10,0...
> \secondoftwoarguments #1#2->#2
>
> l.71 \stopPSTRICKS
> ----------------------------
>
> This message persists even if I just say \startPSTRICKS and
> \stopPSTRICKS.
>
> My version is
> ----------------------------------
> TeXExec 2.6 - ConTeXt / PRAGMA ADE 1997-2001
>
> executable : pdfetex
> format : cont-en
> inputfile : freec
> output : pdftex
> interface : en
> current mode : all
> TeX run : 1
>
> This is pdfeTeX, Version 3.14159-13d-2.1 (Web2C 7.3.1)
> entering extended mode
> (freec.tex[/usr/share/texmf/pdftex/config/pdftex.cfg]
>
> ConTeXt ver: 2001.11.13 fmt: 2002.3.28 int: english mes: english
> -------------------------------
> Is this what I should see?
>
> Sorry to be such a bother!
>
> John Culleton
>
>
>
> __________________________________________________
> D O T E A S Y - "Join the web hosting revolution!"
> http://www.doteasy.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2002-04-02 18:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-11 18:33 Context and PSTricks John Culleton
2002-03-11 22:56 ` Hans Hagen
2002-03-12 7:57 ` Eckhart Guthöhrlein
2002-03-12 9:19 ` Taco Hoekwater
2002-03-12 12:12 ` Hans Hagen
2002-04-02 16:56 ` John Culleton
2002-04-02 18:13 ` W. Egger
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).