[pstricks] ConTeXt and PSTricks

Fabrice couvreur.fabrice at wanadoo.fr
Sun Oct 12 11:43:20 CEST 2014


Hi Herbert,
Seeing come on the forum ConTeXt nothing, I modified the file 
m-pstricks.mkii as follows:

> %D \module
> %D   [       file=m-pstricks,
> %D        version=1997.01.15,
> %D          title=\CONTEXT\ Extra Modules,
> %D       subtitle=\PSTRICKS\ Connections,
> %D         author=Hans Hagen,
> %D           date=\currentdate,
> %D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
> %C
> %C This module is part of the \CONTEXT\ macro||package and is
> %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
> %C details.
>
> % pstricks is not supported in context mkii (it's no problem doing that
> % but as we also need to support latex it would become quite messy so for
> % context we use metapost and for latex pstricks)
>
> %M \usemodule[pstric]
>
> \letvalue{@unused}\plussixteen
> \letvalue{alloc@}\gobblefivearguments
>
> \chardef\oldbarcode\the\catcode`\|  \catcode`\|=12
>
> \def\loadpstrickscolors#1%
>   {\pushmacro\dodefinecolor
>    \pushmacro\dodefinepalet
>    \pushmacro\dodefinecolorgroup
>    \def\dodefinecolor[##1][##2]%
>      {\doifassignmentelse{##2}
>         {\getparameters[pstricks][r=0,g=0,b=0,##2]%
>          \expanded{\newrgbcolor{##1}{{\pstricksr} {\pstricksg} 
> {\pstricksb}}}}%
>         {}}%
>    \def\dodefinepalet     [##1][##2]{}%
>    \def\dodefinecolorgroup[##1][##2][##3]{}%
>    \writestatus{pstricks}{loading colors from #1}%
>    \input #1 \relax
>    \popmacro\dodefinecolorgroup
>    \popmacro\dodefinepalet
>    \popmacro\dodefinecolor}
>
> \doifelse{\jobsuffix}{dvi}
>   {\input multido  \relax
>    \input pstricks \relax
>    \input pst-plot \relax
> \loadpstrickscolors{colo-rgb.mkii}}
>   {\writestatus{pstricks}{using indirect method; enable write18}}
>
> \catcode`\|=\oldbarcode
>
> \def\loadpstricksmodule[#1]%
>   {\chardef\oldbarcode\the\catcode`\|
>    \catcode`\|=12
>    \readfile{#1}{}{}%
>    \catcode`\|=\oldbarcode}
>
> %D The next piece of code is for John Culleton who suggested to
> %D handle \PSTRICKS\ in a similar fashion as \METAPOST, i.e.\
> %D using a child process. For the moment there is no support
> %D for passing environments, so these should be called
> %D explicitly inside this environment.
>
> \unprotect
>
> %D \startPSTRICKS[offset=2pt] ... \stopPSTRICKS
> %D
> %D works in both dvi and pdf mode
> %D
> %D % \usemodule[pstric]
> %D
> %D \startPSTRICKS
> %D   \pspicture(0,0)(10,10)
> %D     \dorecurse{10}{\psline(0,0)(\recurselevel,10)}
> %D     \dorecurse{10}{\psline(0,0)(10,\recurselevel)}
> %D   \endpspicture
> %D \stopPSTRICKS
>
> \def\startPSTRICKS
>   {\dosingleempty\dostartPSTRICKS}
>
> % \ifx\startTEXapplication\undefined
> %
> % \long\def\dostartPSTRICKS[#1]#2\stopPSTRICKS
> %   {\doifelse{\jobsuffix}{dvi}
> %      {#2}
> %      {\bgroup
> %       \setbuffer[pstricks]%
> %         \usemodule[pstric]%
> %         \setbox\scratchbox\hbox{#2}%
> %         % There is probably a nicer way to handle this
> %         \immediate\openout\scratchwrite=\bufferprefix dim.tmp
> % \immediate\write\scratchwrite{\dimen0=\the\ht\scratchbox}%
> % \immediate\write\scratchwrite{\dimen2=\the\wd\scratchbox}%
> %         \immediate\closeout\scratchwrite
> %         % Quick and dirty
> %         \startTEXpage[#1]\box\scratchbox\stopTEXpage
> %       \endbuffer
> %       % Here we go!
> %       %\immediate\write18{texexec \bufferprefix pstricks.tmp --once 
> --batch}%
> %       %\immediate\write18{dvips -G0 -Ppdf \bufferprefix pstricks -o}%
> %       %\immediate\write18{ps2pdf  \bufferprefix pstricks.ps 
> \bufferprefix pstricks.pdf}%
> %       \executesystemcommand{texexec \bufferprefix pstricks.tmp 
> --once --batch}%
> %       \executesystemcommand{dvips -G0 -Ppdf \bufferprefix pstricks -o}%
> %       \executesystemcommand{texmfstart pstopdf \bufferprefix 
> pstricks.ps \bufferprefix pstricks.pdf}%
> %       % We pick up the dimensions from the scratch file.
> %       \readlocfile{\bufferprefix pstricks-dim.tmp}{}{}%
> %       % Since the graphic is put on a page (sigh) by dvips/gs
> %       % we need to shift it around a bit.
> %       \setbox\scratchbox\hbox
> %         {\externalfigure[\bufferprefix pstricks.pdf][\c!object=\v!no]}%
> %       \setbox\scratchbox\hbox
> % {\lower\ht\scratchbox\hbox{\raise\dimen2\box\scratchbox}}%
> %       \wd\scratchbox\dimen0
> %       \ht\scratchbox\dimen2
> %       \dp\scratchbox\zeropoint
> %       \box\scratchbox
> %       \egroup}}
> %
> % \fi
>
> \long\def\dostartPSTRICKS[#1]#2\stopPSTRICKS
>   {\doifelse{\jobsuffix}{dvi} % will some day move to app as switch
>      {\hbox{#2}}
> % {\startTEXapplication[#1]{\usemodule[pstric]}#2\stopTEXapplication}}
>      {\startTEXapplication[#1]{}#2\stopTEXapplication}}
>
> \protect \endinput

I then compiled the example with minimal ConTeXt, but I get the 
following error :
> fab at debian:~$ source context/tex/setuptex
> Setting "/home/fab/context/tex" as ConTeXt root.
> fab at debian:~$ context ntg.tex
>
> mtx-context     | run 1: luatex 
> --fmt="/home/fab/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en" 
> --jobname="ntg" 
> --lua="/home/fab/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en.lui" 
> --no-parse-first-line --c:currentrun=1 --c:fulljobname="./ntg.tex" 
> --c:input="./ntg.tex" --c:kindofrun=1 --c:maxnofruns=8 "cont-yes.mkiv"
> This is LuaTeX, Version beta-0.79.1 (TeX Live 2014/dev) (rev 4972)
>  \write18 enabled.
> open source     > 1 > 1 > 
> /home/fab/context/tex/texmf-context/tex/context/base/cont-yes.mkiv
>
> ConTeXt  ver: 2014.10.09 15:22 MKIV beta  fmt: 2014.10.12  int: 
> english/english
>
> system          > 'cont-new.mkiv' loaded
> open source     > 2 > 2 > 
> /home/fab/context/tex/texmf-context/tex/context/base/cont-new.mkiv
> close source    > 2 > 2 > 
> /home/fab/context/tex/texmf-context/tex/context/base/cont-new.mkiv
> system          > files > jobname 'ntg', input './ntg', result 'ntg'
> fonts           > latin modern fonts are not preloaded
> languages       > language 'en' is active
> open source     > 2 > 3 > /home/fab/ntg.tex
> resolvers       > modules > 'pstricks' is loaded
> open source     > 3 > 4 > 
> /home/fab/context/tex/texmf-context/tex/context/base/m-pstricks.mkiv
> resolvers       > lua > loading file 
> '/home/fab/context/tex/texmf-context/tex/context/base/m-pstricks.lua' 
> succeeded
> close source    > 3 > 4 > 
> /home/fab/context/tex/texmf-context/tex/context/base/m-pstricks.mkiv
> fonts           > preloading latin modern fonts (second stage)
> fonts           > 'fallback modern-designsize rm 12pt' is loaded
> This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) 
> (preloaded format=cont-en)
>  \write18 enabled.
> entering extended mode
> (./ntg-pstricks-0001.tmp
>
> ConTeXt  ver: 2013.06.07 17:34 MKII  fmt: 2014.10.12  int: english/english
>
> system          : cont-new.mkii loaded
> (/home/fab/context/tex/texmf-context/tex/context/base/cont-new.mkii
> systems         : beware: some patches loaded from cont-new.mkii
> )
> system          : cont-sys.rme loaded
> (/home/fab/context/tex/texmf-context/tex/context/user/cont-sys.rme
> (/home/fab/context/tex/texmf-context/tex/context/base/type-siz.mkii)
> (/home/fab/context/tex/texmf-context/tex/context/base/type-one.mkii))
> system          : ntg-pstricks-0001.top loaded
> (./ntg-pstricks-0001.top)
> bodyfont        : 12pt rm is loaded
> language        : patterns nl->texnansi:texnansi->1->2:2 
> nl->ec:ec->2->2:2 us->
> ec:ec->3->2:3 de->texnansi:texnansi->4->3:3 de->ec:ec->5->3:3 
> da->ec:ec->6->2:2
>  sv->ec:ec->7->2:2 af->ec:ec->8->2:2 gb->ec:ec->9->2:2 
> fr->texnansi:texnansi->1
> 0->2:2 fr->ec:ec->11->2:2 es->ec:ec->12->2:2 ca->ec:ec->13->2:2 
> it->texnansi:te
> xnansi->14->2:2 it->ec:ec->15->2:2 la->ec:ec->16->2:2 
> pt->texnansi:texnansi->17
> ->2:2 pt->ec:ec->18->2:2 ro->ec:ec->19->2:2 pl->pl0:pl0->20->2:2 
> pl->ec:ec->21-
> >2:2 pl->qx:qx->22->2:2 cs->il2:il2->23->2:2 cs->ec:ec->24->2:2 
> sk->il2:il2->25
> ->2:2 sk->ec:ec->26->2:2 hr->ec:ec->27->2:2 sl->ec:ec->28->2:2 
> tr->ec:ec->29->2
> :2 tk->ec:ec->30->1:2 lt->l7x:l7x->31->2:2 agr->agr:agr->33->2:2 
> fi->ec:ec->34-
> >2:2 hu->ec:ec->35->2:2 ru->t2a:t2a->37->2:2 uk->t2a:t2a->38->3:3 loaded
> specials        : dvips loaded
> systems         : system commands are enabled
> language        : language en is active
> publications    : file ntg-pstricks-0001.bbl not found, waiting for bibtex
> systems         : begin file ntg-pstricks-0001 at line 1
> system          : module pstric (mkii) loaded
> (/home/fab/context/tex/texmf-context/tex/context/base/m-pstricks.mkii
> ! I can't find file `multido'.
> <argument> \input multido
>                           \relax \input pstricks \relax \input 
> pst-plot \rel...
>
> \firstoftwoarguments #1#2->#1
>
> l.47 ...s}{using indirect method; enable write18}}
>
> (Press Enter to retry, or Control-D to exit)
> Please type another input file name:

Best regards,
Fabrice

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/pstricks/attachments/20141012/cb57cae6/attachment.html>


More information about the PSTricks mailing list