Article View: comp.text.tex
Article #32Attention PSTricksters: Change in SpecialCoor (AGAIN!!).
From: Timothy Van Zandt
Date: Tue, 27 Oct 1992 23:21
Date: Tue, 27 Oct 1992 23:21
226 lines
7935 bytes
7935 bytes
Ignore my previous posting about a change in \SpecialCoor.
The next version of PSTricks will have an incompabible change
to coordinate syntax when \SpecialCoor is in effect. Please
switch immediately to the new usage. (The old usage will
typically not cause complaints, but not give the right result either.)
The code that implements the change, as well as a description of
the new usage, is in the appended file, pstricks.bug. It also includes
two other bug announcements and patches.
Tim
---
Timothy Van Zandt (609)258-4050 tvz@Princeton.EDU (NeXTMail)
Dept. of Economics, Princeton University, Princeton, NJ 08544
%%%%%%%%%%%%%%%%%%%%%%%%%% pstricks.bug %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LAST MODIFIED: October 27, 1992
%% The latest version of this file can be obtained from Princeton.EDU.
%%
%% This file list some bugs and latebreaking news for the PSTricks package,
%% version 0.92, released October 8, 1992.
%% (Contact tvz@Princeton.EDU if you picked up this version before then.)
%%
%% To incorprate these patches, input this file at the end of pstricks.con.
%%
%% Contents:
%% 1. Bug in \scalebox and \scaleboxto.
%% 2. Problem with \lput, etc. with dvips 5.490 and later.
%% 3. Change in \SpecialCoor. (SWITCH IMMEDIATELY TO NEW USAGE PLEASE!!!)
%% 1. Bug in \scalebox and \scaleboxto.
% (Thanks Patrice Belleville.) \scalebox and \scaleboxto don't work when
% the vertical scaling factor is less than 1. The definition of \@scalebox
% should be changed to:
\def\@scalebox#1{\hbox{%
\ht#1=\pst@tempb\ht#1%
\dp#1=\pst@tempb\dp#1%
\pst@dima=\pst@tempa\wd#1%
\ifdim\pst@dima<\z@\hskip-\pst@dima\fi
\pst@Verb{\pst@tempa\space \pst@tempb\space \tx@Scale}%
\hbox to \z@{\box#1\hss}%
\pst@Verb{1 \pst@tempa\space div 1 \pst@tempb\space div \tx@Scale}%
\ifdim\pst@dima>\z@\hskip\pst@dima\fi}}
%% 2. Problem with \lput, etc. with dvips 5.490 and later.
% (Thanks Thomas Worsch) \lput and company, as well as \rput with node or
% polar coordinates, may work erratically with newer versions of dvips
% (e.g., 5.491). This is the fix for \lput. Fix for polar coordinates
% is under item (3):
\def\psput@special#1{\hbox{%
\pst@Verb{%
/lmtrx [ tx@Dict /lmtrx known { lmtrx aload pop } if CM ] def
CP \pst@thecoor CP 3 -1 roll sub neg 3 1 roll sub exch translate moveto }%
\box#1\pst@Verb{CP /lmtrx [ lmtrx aload pop setmatrix ] def moveto}}}
%% 3. Change in \SpecialCoor. (SWITCH IMMEDIATELY TO NEW USAGE PLEASE!!!)
% The \SpecialCoor command is modified. Here is the new syntax for
% coordinates when \SpecialCoor is in effect:
%
% (3,5) : Cartesian, like old (c{3,5})
% (3;110) : Polar, like old (p{3,110})
% (node) : like old (n{node})
% ([par]node) : like old (N[par]{node})
% (node|3;110) : mixed, like old (m{n{node}}{p{3,110}})
%
% \SpecialCoor effectively makes \Polar obsolete (although \Polar will
% be retained for backwards compatibility). An advantage to using
% \SpecialCoor instead of \Polar for polar coordinates is that
% you are less likely to mix up Cartesian and polar coordinates (e.g.,
% is (3,15) Cartesian or polar?).
%
% As before, \Cartesian switches out of \SpecialCoor mode.
%
% Compared to when \Cartesian is in effect, \SpecialCoor simply expands
% the variety of coordinates you can use. The only down side is that
% \SpecialCoor slows TeX's and PostScript's coordinate processing down
% slightly. This is the only reason it is available on demand rather
% than by default. Not a big deal on your average computer.
%
% Here is an uninspired example:
%
% \cnode(3,3){2pt}{a}
% \rnode{b}{\bf Some stuff is here}
% \SpecialCoor
% \pspolygon([angle=90,nodesep=10pt]b)([angle=90,nodesep=10pt]b|a)
% (a|*3,60)(-1,3)(:-1,-2)
%
% Here is the implementation:
%
% \begin{macro}{\psput@,\psput@cart,\psput@polar,\psput@special}
% \begin{macrocode}
\def\psput@#1{\pst@@getcoor{#1}\leavevmode\psput@@}
\def\psput@@{\psput@@@}
\def\psput@cart#1{\vbox to \z@{\vss
\hbox to \z@{\kern\pst@dimg\box#1\hss}\vskip\pst@dimh}}
\def\psput@Special#1{%
\hbox{\pst@Verb{\tx@TA \pst@thecoor \tx@TB}\box#1\pst@Verb{\tx@TC}}}
\def\tx@TA{%
/lmtrx [ tx@Dict /lmtrx known { lmtrx aload pop } if CM ] def
CP gsave CP translate CM \tx@STV}
\def\tx@TB{translate 0 0 moveto setmatrix CP grestore translate moveto }
\def\tx@TC{CP /lmtrx [ lmtrx aload pop setmatrix ] def moveto }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Cartesian,getcoor@c}
% \begin{macrocode}
\def\getcoor@c#1,#2,#3\@nil{%
\pssetxlength\pst@dimg{#1}%
\pssetylength\pst@dimh{#2}%
\edef\pst@thecoor{\pst@number\pst@dimg\pst@number\pst@dimh}}
\def\Cartesian{%
\let\psput@@\psput@cart
\def\pst@@getcoor##1{%
\edef\pst@tempg{##1}%
\expandafter\getcoor@c\pst@tempg,\relax,\@nil}%
\@ifnextchar({\Cartesian@}{}}
\def\Cartesian@(#1,#2){%
\pssetxlength\psxunit{#1}%
\pssetylength\psyunit{#2}%
\ignorespaces}
\Cartesian
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Polar,\getcoor@p}
% \begin{macrocode}
\def\getcoor@p#1,#2,#3\@nil{%
\pssetlength\pst@dimg{#1}%
\pst@checknum{#2}\pst@tempg
\edef\pst@thecoor{\pst@number\pst@dimg \pst@tempg\space \tx@PtoC}}
\def\Polar{%
\let\psput@@\psput@Special
\def\pst@@getcoor##1{%
\edef\pst@tempg{##1}%
\expandafter\getcoor@p\pst@tempg,\relax,\@nil}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\SpecialCoor}
% \begin{macrocode}
\def\SpecialCoor{%
\let\psput@@\psput@Special
\def\pst@@getcoor##1{%
\edef\pst@tempg{##1}%
\expandafter\getcoor@i\pst@tempg||\@nil}}
\def\getcoor@i#1|#2|#3\@nil{%
\ifx#3|\relax
\begingroup
\getcoor@ii#1;;\@nil
\let\pst@tempa\pst@thecoor
\getcoor@ii#2;;\@nil
\xdef\pst@tempg{\pst@tempa pop \pst@thecoor exch pop }%
\endgroup
\let\pst@thecoor\pst@tempg
\else
\getcoor@ii#1;;\@nil
\fi}
\def\getcoor@ii#1{%
\ifcat#1a\relax
\def\next{\getcoor@n#1}%
\else
\ifx#1[\relax
\def\next{\getcoor@N[}%
\else
\def\next{\getcoor@iii#1}%
\fi
\fi
\next}
\def\getcoor@iii#1;#2;#3\@nil{%
\ifx#3;\relax
\getcoor@p#1,#2,\@nil
\else
\getcoor@c#1,\relax,\@nil
\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\getcoor@n}
% \begin{macrocode}
\def\getcoor@n#1;#2\@nil{%
\checknode@{#1}\pst@tempg
\edef\pst@thecoor{%
tx@Dict \pst@tempg known
{ \pst@tempg load begin
x y mtrxf transform CM itransform
end }
{ 0 0 }
ifelse }}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\getcoor@N}
% \begin{macrocode}
\def\getcoor@N[#1]#2;#3\@nil{%
\begingroup
\psset{#1}%
\checknode@{#2}\pst@tempg
\xdef\pst@tempg{%
tx@Dict \pst@tempg known
{ \pst@tempg load begin
/angle \psk@angleA def
/offset \psk@offsetA def
/nodesep \psk@nodesepA def
\tx@GetDPos
end }
{ 0 0 }
ifelse }%
\endgroup
\let\pst@thecoor\pst@tempg}
% \end{macrocode}
% \end{macro}
%%%%%%%%%%%%%%%%%%%%%%%%%% end pstricks.bug %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--
Timothy Van Zandt (609)258-4050 tvz@Princeton.EDU (NeXTMail)
Dept. of Economics, Princeton University, Princeton, NJ 08544
Technical Details
Message-ID:
<1992Oct27.232121.4309@Princeton.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!haven.umd.edu!darwin.sura.net!jvnc.net!princeton!zandtwerk.Princeton.EDU!tvzShow Full Headers
Complete Article Headers
Newsgroups: comp.text.tex Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!haven.umd.edu!darwin.sura.net!jvnc.net!princeton!zandtwerk.Princeton.EDU!tvz From: tvz@zandtwerk.Princeton.EDU (Timothy Van Zandt) Subject: Attention PSTricksters: Change in SpecialCoor (AGAIN!!). Message-ID: <1992Oct27.232121.4309@Princeton.EDU> Originator: tvz@zandtwerk.Princeton.EDU Sender: news@Princeton.EDU (USENET News System) Nntp-Posting-Host: zandtwerk.princeton.edu Organization: Princeton University Date: Tue, 27 Oct 1992 23:21:21 GMT Lines: 226