Re: [NTG-context] pstrics module again

2013-11-26 Thread Herbert Voss

Am 26.11.2013 00:08, schrieb DesdeChaves:

I d'ont know how to fix the picture size.
No errors at all, but the figure size isn't correct.


did you used ps2pdf -dAutoRotatePages=/None file   ??

Herbert



\usemodule[pstric]

\starttext


Hydrogen spectrum

\startPSTRICKS
\input pst-spectra.tex
\input pstricks-add.tex
\pspicture(0,-2.5)(\textwidth,1.6)
\psspectrum[element=H, emission](0,0)(\textwidth,1.5)
\rput(2,1){Hydrogen spetrum}
\endpspicture
\stopPSTRICKS




\stoptext


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] pstrics module again

2013-11-25 Thread Aditya Mahajan

On Mon, 25 Nov 2013, DesdeChaves wrote:


Dear sirs

The pstrics module don't work anymore. I tried to run this simple code but
I found a lot of errors.

\usemodule[pstric]
\starttext
\startPSTRICKS
\pspicture(0,0)(20,20)
\psline(0,0)(20,20)
\psline(1,1)(10,10)
\endpspicture
\stopPSTRICKS
\stoptext


It appears that pstrick files are no longer part of the standalone 
distribution, but if you copy a bunch of files, then the above example 
does work.



This module is no longer supported?
There is still any hope of being able to use pstric and some of its
extensions (pst-spectra, for example)?


This is what I did.

1. Compile the file. You get an error that some pstrick file is missing. 
Locate that file in the texlive directory and copy it to the current 
directory.


2. Repeat until you get an error that \ifx! is not a valid control 
sequence.


3. Run `grep ifx! *.tex` and change all the \ifx!#1 to \ifx !#1.

4. Then you get an error that colo-rgb is missing. Copy colo-rgb.mkii to 
the current directory as colo-rgb.tex.


5. Then you get a error message the some .pro file is missing. Find that 
file from the texlive directory and copy it to the current directory. 
Repeat until all errors are resolved.


Finally you'll get the correct output.

So it seems that if pstricks is added back to the minimals (so that errors 
in step 1 and 5 don't happen), then it should be straightforward to get it 
to work with context. (Just load the file with the correct catcode regime, 
so that ! is a other character, and the error in step 2-3 will not 
happen). THe error in step 3 is easy to fix by editing m-pstricks.


Aditya
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] pstrics module again

2013-11-25 Thread Herbert Voss

Am 25.11.2013 19:55, schrieb Aditya Mahajan:


This is what I did.

1. Compile the file. You get an error that some pstrick file is missing.
Locate that file in the texlive directory and copy it to the current
directory.

2. Repeat until you get an error that \ifx! is not a valid control
sequence.

3. Run `grep ifx! *.tex` and change all the \ifx!#1 to \ifx !#1.


why does ConTeXt needs the space before the !  ??

Herbert

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] pstrics module again

2013-11-25 Thread Aditya Mahajan

On Mon, 25 Nov 2013, Herbert Voss wrote:


Am 25.11.2013 19:55, schrieb Aditya Mahajan:


This is what I did.

1. Compile the file. You get an error that some pstrick file is missing.
Locate that file in the texlive directory and copy it to the current
directory.

2. Repeat until you get an error that \ifx! is not a valid control
sequence.

3. Run `grep ifx! *.tex` and change all the \ifx!#1 to \ifx !#1.


why does ConTeXt needs the space before the !  ??


ConTeXt has two catcode regimes: the standard catcode regime and the 
unprotected catcode regime.


In the unprotected catcode regime, !, _, and @ are also letters. This is 
done so that one can use csnames such as \c!width, \!!plusone, etc. 
(Similar to \makeatletter in LaTeX).


I haven't looked at the actual code, but I am guessing that at some place, 
the following code is being called:


\unprotect
\input pstricks
\protect

and therefore when ConTeXt sees \ifx!#1 it thinks that \ifx! is a csname. 
Adding a space after \ifx avoids that.


As I said in my previous message, this is easy to fix at ConTeXt end 
defining an appropriate catcode regime before inputing pstricks.


So, the pstricks package does not need to be changed, but the ConTeXt code 
that is calling the package needs to be adapted.


Aditya
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] pstrics module again

2013-11-25 Thread Herbert Voss

Am 25.11.2013 21:25, schrieb Aditya Mahajan:


\unprotect
\input pstricks
\protect

and therefore when ConTeXt sees \ifx!#1 it thinks that \ifx! is a
csname. Adding a space after \ifx avoids that.

As I said in my previous message, this is easy to fix at ConTeXt end
defining an appropriate catcode regime before inputing pstricks.

So, the pstricks package does not need to be changed, but the ConTeXt
code that is calling the package needs to be adapted.


ok, understood.

thanks,
Herbert
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] pstrics module again

2013-11-25 Thread DesdeChaves
I d'ont know how to fix the picture size.
No errors at all, but the figure size isn't correct.

\usemodule[pstric]

\starttext


Hydrogen spectrum

\startPSTRICKS
\input pst-spectra.tex
\input pstricks-add.tex
\pspicture(0,-2.5)(\textwidth,1.6)
\psspectrum[element=H, emission](0,0)(\textwidth,1.5)
\rput(2,1){Hydrogen spetrum}
\endpspicture
\stopPSTRICKS




\stoptext


2013/11/25 DesdeChaves desdecha...@gmail.com

  radical solution

  Download and unpack the PSTRicks-TDS.tar to a directory
  cp ./PSTricks-TDS/tex/generic/*/*.tex .
  perl -pi.back -e 's/\ifx!#1/\ifx !#1/g;' *.tex
  rm -rf *.back
  cp /usr/local/texlive/2013/texmf-dist/tex/context/base/colo-rgb.mkii
 ./colo-rgb.tex
  run context

  change in m-pstric.* files ps2pdf to pstopdf

 tanks a lot

 Jorge


 2013/11/25 Herbert Voss herbert.v...@fu-berlin.de

 Am 25.11.2013 21:25, schrieb Aditya Mahajan:


  \unprotect
 \input pstricks
 \protect

 and therefore when ConTeXt sees \ifx!#1 it thinks that \ifx! is a
 csname. Adding a space after \ifx avoids that.

 As I said in my previous message, this is easy to fix at ConTeXt end
 defining an appropriate catcode regime before inputing pstricks.

 So, the pstricks package does not need to be changed, but the ConTeXt
 code that is calling the package needs to be adapted.


 ok, understood.

 thanks,
 Herbert

 
 ___
 If your question is of interest to others as well, please add an entry to
 the Wiki!

 maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/
 listinfo/ntg-context
 webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 
 ___




 --
 Atentamente

 DesdeChaves




-- 
Atentamente

DesdeChaves
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] pstrics module again

2013-11-25 Thread Aditya Mahajan

On Mon, 25 Nov 2013, DesdeChaves wrote:


I d'ont know how to fix the picture size.
No errors at all, but the figure size isn't correct.


Confirmed.


\usemodule[pstric]

\starttext

Hydrogen spectrum

\startPSTRICKS
\input pst-spectra.tex
\input pstricks-add.tex
\pspicture(0,-2.5)(\textwidth,1.6)
\psspectrum[element=H, emission](0,0)(\textwidth,1.5)
\rput(2,1){Hydrogen spetrum}
\endpspicture
\stopPSTRICKS

\stoptext


The proper interface is

\usemodule[pstricks]

\usePSTRICKSmodule[pst-add]
\usePSTRICKSmodule[pst-spectra]

When you run the above file, ConTeXt creates the following temp file:

\starttext
\pushcatcodetable
\setcatcodetable\texcatcodes
\usemodule[pstric]
\readfile{pst-add}{}{}
\readfile{pst-spectra}{}{}
\popcatcodetable
\startTEXpage
\hbox\bgroup
\ignorespaces
\pspicture(0,-2.5)(\textwidth,1.6)
\psspectrum[element=H, emission](0,0)(\textwidth,1.5)
\rput(2,1){Hydrogen spetrum}
\endpspicture
\removeunwantedspaces
\egroup
\obeydepth % temp hack as we need to figure this out
\stopTEXpage
\stoptext

runs mtxrun --script texexec %s --once --dvips filename
and then runs ps2pdf inputname outputname

but that generates the file with the wrong size. dvips gives the following 
error message:


' TeX output 2013.11.25:1841' - test-pstricks-0001.ps
Page 1 may be too complex to print
dvips: no match for special paper size found; using default

(and that is the reason for the wrong paper size).

It has been years since I used dvips, so I don't remember how to correct 
that. Basically, the bug is with the following file:


\starttext
\startTEXpage
  What will happen now
\stopTEXpage
\stoptext

Process using mtxrun --script test --dvips and then ps2pdf and the 
resulting pdf file has the wrong bounding box.


Aditya

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] pstrics module again

2013-11-25 Thread Aditya Mahajan

On Mon, 25 Nov 2013, Aditya Mahajan wrote:

It has been years since I used dvips, so I don't remember how to correct 
that. Basically, the bug is with the following file:


\starttext
\startTEXpage
 What will happen now
\stopTEXpage
\stoptext

Process using mtxrun --script test --dvips and then ps2pdf and the 
resulting pdf file has the wrong bounding box.


The file processes correctly (but in landscape orientation) when using 
pstopdf, so it is just a bug of ps2pdf.


The header of the ps file is:

%!PS-Adobe-2.0
%%Creator: dvips(k) 5.993 Copyright 2013 Radical Eye Software
%%Title: test.dvi
%%CreationDate: Mon Nov 25 18:43:15 2013
%%Pages: 1
%%PageOrder: Ascend
%%Orientation: Landscape
%%BoundingBox: 0 0 15 117
%%DocumentFonts: LMRoman12-Regular
%%EndComments
%DVIPSWebPage: (www.radicaleye.com)
%DVIPSCommandLine: dvips -u +original-base -u +original-ams-base -u
%+ +original-public-lm -u +lm-ec -u +lm-math -u +lm-rm -u
%+ +original-ams-euler test
%DVIPSParameters: dpi=600
%DVIPSSource:  TeX output 2013.11.25:1843
%%BeginProcSet: tex.pro 0 0
%!

Why is dvips adding Orientation: Landscape in the header?
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___