🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #22

Attention PSTricksters: Changes to ÓpecialCoor.

#22
From: Timothy Van Zandt
Date: Tue, 27 Oct 1992 18:29
218 lines
7815 bytes
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.

Thanks.

Tim
---
Timothy Van Zandt   (609)258-4050  tvz@Princeton.EDU (NeXTMail)
Dept. of Economics,  Princeton University,  Princeton, NJ 08544



%%%%%%%%%%%%%%%%%%%%%%%%%% pstricks.bug %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LAST MODIFIED: October 23, 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. Now, \SpecialCoor switches you
% into a mode where Cartesian and polar coordinates work as usual (as do
% the \Polar and \Cartesian commands), but you can also include other types
% of coordinates (see User's Guide for description of old usage):
%
%   (node)        : like old (n{node})
%   ([par]node)   : like old (N[par]{node})
%   (*3,110)      : polar, like old (p{3,110})
%   (:3,5)        : Cartesian, like old (c{3,5})
%   (node|3,110)  : mixed, like old (m{node}{3,110})
%
% If \Cartesian is currently in effect, (3,5) and (:3,5) give same result.
% If \Polar is currently in effect, (3,110) and (*3,110) give same result.
%
% \SpecialCoor slows TeX's and PostScript's coordinate processing down
% slightly, which 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)

% \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
  \let\pst@@@getcoor\getcoor@c
  \@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\psput@@{\psput@polar}}
\def\Polar{%
  \let\psput@@@\psput@cart
  \let\pst@@@getcoor\getcoor@p}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\SpecialCoor}
%    \begin{macrocode}
\def\pst@@getcoor#1{%
  \edef\pst@tempg{#1}%
  \expandafter\pst@@@getcoor\pst@tempg,*,\@nil}
\def\SpecialCoor{%
  \let\psput@@\psput@Special
  \let\pst@@getcoor\getcoor@special}
\def\getcoor@special#1{%
  \edef\pst@tempg{#1}%
  \expandafter\getcoor@@special\pst@tempg||\@nil}
\def\getcoor@@special#1|#2|#3\@nil{%
  \ifx#3|\relax
    \begingroup
      \getcoor@@@special#1,*,\@nil
      \let\pst@tempa\pst@thecoor
      \getcoor@@@special#2,*,\@nil
      \xdef\pst@tempg{\pst@tempa pop \pst@thecoor exch pop }
    \endgroup
    \let\pst@thecoor\pst@tempg
  \else
    \getcoor@@@special#1,*,\@nil
  \fi}
\def\getcoor@@@special#1{%
  \ifcat#1a%
    \def\next{\getcoor@n#1}%
  \else
    \ifx#1[%
      \def\next{\getcoor@N[}%
    \else
      \ifx#1*%
        \def\next{\getcoor@p}%
      \else
        \ifx#1:%
          \def\next{\getcoor@c}%
        \else
          \def\next{\pst@@@getcoor#1}%
        \fi
      \fi
    \fi
  \fi
  \next}
%    \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{\def\pst@par{}\pst@object{getcoor@N}}
\def\getcoor@N@i#1,#2\@nil{%
  \begingroup
    \use@par
    \checknode@{#1}\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.182943.29654@Princeton.EDU>
Path: arc1-ca.pugleaf.net!sparky!uunet!kithrup!hoptoad!pacbell.com!ames!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!jvnc.net!princeton!zandtwerk.Princeton.EDU!tvz

Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex
Path: arc1-ca.pugleaf.net!sparky!uunet!kithrup!hoptoad!pacbell.com!ames!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!jvnc.net!princeton!zandtwerk.Princeton.EDU!tvz
From: tvz@Princeton.EDU (Timothy Van Zandt)
Subject: Attention PSTricksters: Changes to ÓpecialCoor.
Message-ID: <1992Oct27.182943.29654@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 18:29:43 GMT
Lines: 218