[pstricks] Origin in (1994,0)
Jean-Côme Charpentier
Jean-Come.Charpentier at wanadoo.fr
Fri Apr 28 20:21:13 CEST 2006
Denis Vergès a écrit :
> [...]
>>if you get something like "dimension too large" and no output in the
>>resulting
>>picture, that I would be too interested in what's wrong, since this
>>problem
>>bothers me a lot sometimes.
You ask for a x-coor 1994. Your xunit is 0.85cm. Then, you ask for a
1994\times0.85=1694.9cm. The max dimen for TeX is 2^{30}sp; that is,
2^{14}pt, that is, 226.7054102670541in, that is, 575.8317420783174cm.
TeX isn't happy and tell you that it is not happy :-)
>>Regards,
>>Boris Dusek
>>
>>On Friday 28 April 2006 14:52, Denis Vergès wrote:
>>
>>>Hello,
>>>
>>>What's wrong in this \pspicture?
>>>Thanks
>>>
>>>Denis Vergès
>>>
>>>%%%%%%%%%%%%%%%%%%%%%
>>>\psset{xunit=0.85cm,yunit=0.0267cm}
>>>\begin{pspicture}(1994,0)(2007,300)
>>>\psaxes[Ox=1994,Dy=50](1994,0)(2007,300)
>>>\psline(1994,67)(1995,59)(1996,90) \psdots(1994,67)(1995,59)(1996,90)
>>>\psline(1994,65)(1995,70)(1996,101)
>>>\psdots(1994,65)(1995,70)(1996,101)
>>>\end{pspicture}
>>>%%%%%%%%%%%%%%%%%%%%%
>>
I don't know if some pst-* (or some pstricks macro) could deal such big
numbers for coordinate. Waiting Herbert, you can write something like that:
\documentclass{article}
\usepackage{pstricks-add}
\makeatletter
\newcount\xscratch
\newcount\yscratch
\def\settranslation#1#2{%
\gdef\xtranslation{#1}% \gdef or \def (or \edef, or \xdef) ?
\gdef\ytranslation{#2}%
\ignorespaces
}
\def\@emptyarg{[]}%
%%%%% translated \psline %%%%%
\def\trpsline{%
% initinialize coor list
\def\@translatecoord{}%
%
\@ifnextchar[{\@trpslinepar}{\@trpslinepar[]}%
}
\def\@trpslinepar[#1]{%
% initialize optional argument
\def\@trarg{[#1]}%
\@trpsline
}
\def\@trpsline(#1,#2){%
% do the translation
\xscratch #1\relax
\advance \xscratch \xtranslation
\yscratch #2\relax
\advance \yscratch \ytranslation
% save translation in coor list
\edef\@translatecoord{\@translatecoord(\the\xscratch,\the\yscratch)}%
% recursive call
\@ifnextchar({\@trpsline}{\@trpslineend}%
}
\def\@trpslineend{%
% call real \psline with coor list translated
\expandafter\expandafter\expandafter
\psline\expandafter\@trarg\@translatecoord
}
%%%%% translated \psdots %%%%%
\def\trpsdots{%
\def\@translatecoord{}%
\@ifnextchar[{\@trpsdotspar}{\@trpsdotspar[]}%
}
\def\@trpsdotspar[#1]{%
\def\@trarg{[#1]}%
\@trpsdots
}
\def\@trpsdots(#1,#2){%
\xscratch #1\relax
\advance \xscratch \xtranslation
\yscratch #2\relax
\advance \yscratch \ytranslation
\edef\@translatecoord{\@translatecoord(\the\xscratch,\the\yscratch)}%
\@ifnextchar({\@trpsdots}{\@trpsdotsend}%
}
\def\@trpsdotsend{%
\expandafter\expandafter\expandafter
\psdots\expandafter\@trarg\@translatecoord
}
\makeatother
\begin{document}
\psset{xunit=0.85cm,yunit=0.0267cm}
\begin{pspicture}(0,0)(13,300)
\psaxes[Ox=1994,Dy=50](0,0)(13,300)
\settranslation{-1994}{0}
\trpsline(1994,67)(1995,59)(1996,90)
\trpsdots(1994,67)(1995,59)(1996,90)
\trpsline(1994,65)(1995,70)(1996,101)
\trpsdots[linecolor=red](1994,65)(1995,70)(1996,101)
\end{pspicture}
\end{document}
Jean-Côme Charpentier
More information about the PSTricks
mailing list