%% BEGIN pstricks.bug
% LAST MODIFIED: October 3, 1994
% The latest version of this file can be obtained from Princeton.EDU.

% This file list some bugs and latebreaking news for PSTricks,
% version 0.93a, released March 12, 1993.

% PROBLEMS:

% 1. \scalebox can report missing number errors or worse, depending
%    on what is in its argument.
%    PATCH: Input this file.
%
% 2. palette.tex keeps loading pstricks.tex.
%    PATCH: In palette.tex, change
%        \ifx\pstricksloaded ...
%      to
%        \ifx\PSTricksLoaded ...
%
% 3. \pscirclebox doesn't leave the right amount of space.
%    PATCH: Input this file.
%
% 4. \ncbar doesn't work right.
%    PATCH: Input this file (AFTER inputting pst-node.tex).
%
% 5. Nested \multips doesn't work.
%    PATCH: Input this file.
%
% 6. \psgrid sometimes gets the size wrong by 1 unit.
%    PATCH: Input this file.
%
% 7. \begin{overlaybox} ... \end{overlaybox} cannot be used instead
%    of \overlaybox ... \endoverlaybox.
%    PATCH: Input this file.
%
% 8. Overlays don't interact properly with rotation.
%    PATCH: Input this file.
%
% 9. Overlays don't work properly with nodes. Specifically, they only work
%    when the nodes and node connections and labels are all on the same
%    overlay.
%    PATCH: Input this file, and include the command \AltOverlayMode
%      before the overlay in which you want to use nodes (before the whole
%      overlay box or slide, or in the beginning of the document).
%      Warning: Normally, overlay material is made invisible by translating
%      it off the page. With \AltOverlayMode, it is done by setting a small
%      clip path somewhere off the page. The material is made visible again
%      by issuing "initclip", which resets the clipping path completely.
%      This makes it incompatible with any other clipping tricks.
%
% 10. SpecialCoor and the : version of nrot do not work when ;!|:
%     do not have \catcode 12 (e.g., with french.sty).
%
%     PATCH: Input this file, and read the following:
%
%     FAQ: What non-standard category codes and active characters are
%       compatible with PSTricks?
%
%       Using non-standard category codes can confuse PSTricks in many ways.
%       What follows is not comprehensive.
%
%       Characters ()[],*=-
%         These must have category code 3, 7, 8, 11 or 12.
%         The category code must be set BEFORE inputting the PSTricks files.
%
%       Characters <>|;!:
%         Same as above, but category code 13 (``active'') is also OK, in
%         which case the code must be 12 when the PSTricks files are input.
%
%       Characters \{}@#$%^&_
%         These should have their usual category codes when PSTricks files
%         are input, but then they can be set arbitrarily.
%
%       Characters +"'.?/~`
%         No restrictions, but generally these should have category code 12
%         when the PSTricks files are input.
%
% 11. Gradient fill style doesn't work the gradmidpoint=0 or gradmidpoint=1.
%     WORKAROUND: Until the next release, set gradmidpoint
%       close to, but not too close to or equal to, 0 or 1.
%
% 12. If using \pscharpath with protected fonts, the dashed and dotted
%     linestyles, setting shadow=true, and \pstextpath produce an
%     invalidaccess error.
%     WORKAROUND: Until the next release, do not use those features with
%     \pscharpath and protected fonts. In the next release, the dashed
%     and dotted line styles will work, and shadow=true and \pstextpath
%     will neither work nor produce errors with protected fonts.
%
% 13. \scalebox and \scaleboxto do not work properly with negative scaling.
%
% 14. With \psplot, setting labels=y or ticks=y does not suppress labels
%     or ticks on the x-axis.
%     PATCH: Get version 0.93a-patched of pst-plot.tex, distributed
%     which is part of the 0.93a distribution starting March 30, 1994.
%
% 15. When lines are very short, linestyle=dash may cause an error.
%     PATCH: Input this file.
%
% 16. \psclipbox does not work.
%     PATCH: Input this file.
%
% 17. Various nodes are missing \leavevmode, which can cause irregularities
%     if they occur at the beginning of a paragraph.
%     WORKAROUND: Put \leavevmode before the offending node command.
%                 E.g., \leavevmode\rnode{foo}
%
% 18. The Textures entry in the configuration file has several problems.
%     WORKAROUND: Contact [email protected] to get a new pstricks.con.
%
% 19. There are two problems with using PSTricks without a header file:
%       1. pst-make.tex gives an error.
%       2. You get a PostScript error.
%     WORKAROUND:
%       1. At the end of pst-make.tex, change to line
%            \MakeInputHpst-coil.doc}{pst-coil.tex}
%          to
%            \MakeInput{pst-coil.doc}{pst-coil.tex}
%          (The `H' become `{').
%       2. In pstricks.doc (before running pst-make.tex) or in
%          pstricks.tex (after running pst-make.tex), add the line
%            /T /translate load def
%          between the lines
%            /CP /currentpoint load def
%            /ED { exch def } bind def
%
% 20. Mixed coordinates do not work with \SpecialCorr
%     PATCH: Input this file.
%
% 21. Axis labels in \psplot use a hyphen instead of a minus sign.
%     PATCH: Get version 0.93a-patched of pst-plot.tex,
%     which is part of the 0.93a distribution starting March 30, 1994.
%
% 22. For certain plotstyle's the \fileplot command does not work.
%     PATCH: Get version 0.93a-patched of pst-plot.tex,
%     which is part of the 0.93a distribution starting March 30, 1994.
%
% 23. \scale does not work in \pscustom.
%     PATCH: Input this file.

\edef\TheAtCode{\the\catcode`\@}
\catcode`\@=11

% 1.
\def\pst@divide#1#2#3{%
 \pst@@divide{#1}{#2}%
 \pst@dimtonum\pst@dimg{#3}}
\def\pst@@divide#1#2{%
 \pst@dimg=#1\relax
 \pst@dimh=#2\relax
 \pst@cntg=\pst@dimh
 \pst@cnth=67108863
 \pst@@@divide\pst@@@divide\pst@@@divide\pst@@@divide
 \divide\pst@dimg\pst@cntg}
\def\pst@@@divide{%
 \ifnum
   \ifnum\pst@dimg<\z@-\fi\pst@dimg<\pst@cnth
   \multiply\pst@dimg\sixt@@n
 \else
   \divide\pst@cntg\sixt@@n
 \fi}
\def\pst@getscale#1#2{%
 \pst@expandafter\pst@getnumii{#1 #1} {} {} {}\@nil
 \@psttrue
 \ifdim\pst@tempg\p@=\z@
   \@pstrickserr{Bad scaling argument `#1'}\@ehpa
   \def\pst@tempg{1 }%
   \@pstfalse
 \fi
 \ifdim\pst@temph\p@=\z@
   \if@pst\@pstrickserr{Bad scaling argument `#1'}\@ehpa\fi
   \def\pst@temph{1 }%
 \fi
 \edef#2{\pst@tempg\space \pst@temph\space scale }%
 \ifdim\pst@tempg\p@=\p@ \ifdim\pst@temph\p@=\p@
   \def#2{}%
 \fi\fi}
\def\scalebox#1{\pst@makebox{\@scalebox{#1}}}
\def\@scalebox#1{%
 \begingroup
   \pst@getscale{#1}\pst@tempa
   \let\pst@tempc\pst@tempg
   \let\pst@tempd\pst@temph
   \@@scalebox
 \endgroup}
\def\@@scalebox{%
 \leavevmode
 \hbox{%
   \ifdim\pst@tempd\p@<\z@
     \pst@dimg=\pst@tempd\ht\pst@hbox
     \pst@dimh=\pst@tempd\dp\pst@hbox
     \dp\pst@hbox=-\pst@dimg
     \ht\pst@hbox=-\pst@dimh
   \else
     \ht\pst@hbox=\pst@tempd\ht\pst@hbox
     \dp\pst@hbox=\pst@tempd\dp\pst@hbox
   \fi
   \pst@dima=\pst@tempc\wd\pst@hbox
   \ifdim\pst@dima<\z@\kern-\pst@dima\fi
   \pst@Verb{CP CP translate \pst@tempa \tx@NET}%
   \hbox to \z@{\box\pst@hbox\hss}%
   \pst@Verb{%
     CP CP translate
     1 \pst@tempc div 1 \pst@tempd div scale
     \tx@NET}%
   \ifdim\pst@dima>\z@\kern\pst@dima\fi}}
\def\scaleboxto(#1,#2){\pst@makebox{\@scaleboxto(#1,#2)}}
\def\@scaleboxto(#1,#2){%
 \begingroup
   \pssetlength\pst@dima{#1}%
   \pssetlength\pst@dimb{#2}%
   \ifdim\pst@dima=\z@\else
     \pst@divide{\pst@dima}{\wd\pst@hbox}\pst@tempc
     \edef\pst@tempc{\pst@tempc\space}%
   \fi
   \ifdim\pst@dimb=\z@
     \ifdim\pst@dima=\z@
       \@pstrickserr{%
         \string\scaleboxto\space dimensions cannot both be zero}\@ehpa
       \def\pst@tempa{}%
       \def\pst@tempc{1 }%
       \def\pst@tempd{1 }%
     \else
       \let\pst@tempd\pst@tempc
     \fi
   \else
     \pst@dimc=\ht\pst@hbox
     \advance\pst@dimc\dp\pst@hbox
     \pst@divide{\pst@dimb}{\pst@dimc}\pst@tempd
     \edef\pst@tempd{\pst@tempd\space}%
     \ifdim\pst@dima=\z@ \let\pst@tempc\pst@tempd \fi
   \fi
   \edef\pst@tempa{\pst@tempc \pst@tempd scale }%
   \@@scalebox
 \endgroup}

% 3.
\def\pscirclebox@ii#1{%
 \begingroup
   \pst@useboxpar
   \setbox\pst@hbox=\hbox{#1\pscirclebox@iii\box\pst@hbox}%
   \ifpsboxsep
     \pst@dima=.5\wd\pst@hbox
     \pst@dimb=\ht\pst@hbox
     \advance\pst@dimb\dp\pst@hbox
     \divide\pst@dimb 2
     \pst@pyth\pst@dima\pst@dimb\pst@dimc
     \advance\pst@dimc\pslinewidth
     \advance\pst@dimc\psframesep
     \advance\pst@dimb-\pst@dimc
     \setbox\pst@hbox=\hbox to2\pst@dimc{%
       \hss
       \vbox{\kern-\pst@dimb\box\pst@hbox}%
       \hss}%
     \advance\pst@dimb-\dp\pst@hbox
     \dp\pst@hbox=-\pst@dimb
   \fi
   \leavevmode\box\pst@hbox
 \endgroup}

% 4.
\pst@def{NCBar}<%
 \tx@GetPos
 \tx@GetArms
 /mtrx AngleA matrix rotate def
 x1a y1a mtrx itransform pop
 x2a y2a mtrx itransform pop sub
 dup 0 mtrx transform
 3 -1 roll 0 gt
 { /y2a exch y2a add def /x2a exch x2a add def }
 { /y1a exch neg y1a add def /x1a exch neg x1a add def }
 ifelse
 mark
 x2 y2 x2a y2a x1a y1a x1 y1
 tx@Dict begin false \tx@Line end
 /LPutVar [ x2 y2 x2 y2 x2a y2a x1a y1a x1 y1 ] cvx def
 /LPutPos { LPutVar \tx@AnglesMP } def>

% 5.
\def\multips{\begingroup\pst@getrputrot\multips@i}
\def\multips@i(#1){\@ifnextchar({\@multips@ii(#1)}{\@multips@ii(0,0)(#1)}}
\def\@multips@ii(#1)(#2)#3#4{%
   \pst@getcoor{#1}\pst@tempa
   \pst@@getcoor{#2}%
   \pst@cnta=#3\relax
   \init@pscode
   \addto@pscode{%
     \pst@tempa T \the\pst@cnta\space \pslbrace
     gsave \ifx\pst@rot\@empty\else\pst@rot rotate \fi }%
   \hbox to\z@{%
     \def\init@pscode{%
       \addto@pscode{%
         gsave
         \pst@number\pslinewidth SLW
         \pst@usecolor\pslinecolor}}%
     \def\use@pscode{\addto@pscode{grestore}}%
     \def\psclip##1{\pst@misplaced\psclip}%
     \def\nc@object##1##2##3##4{\pst@misplaced{node connection}}%
     #4}%
   \addto@pscode{grestore \pst@coor T \psrbrace repeat}%
   \leavevmode
   \use@pscode
 \endgroup
 \ignorespaces}

% 6.
\pst@def{Grid}<%
 newpath
 /a 4 string def            % Empty string
 /b ED                      % Label size
 /c ED                      % Label color procedure.
 /n ED                      % Number of grid dots
 cvi dup 1 lt { pop 1 } if /s ED   % Number subdivisions
% Stack: x-unit y-unit
 s div dup 0 eq { pop 1 } if /dy ED  % y-distance between lines.
 s div dup 0 eq { pop 1 } if /dx ED  % x-distance between lines.
% These two are integer multiples of dx and dy:
 dy div round dy mul /y0 ED     % y-origin.
 dx div round dx mul /x0 ED     % x-origin.
% These four are integers, measuring dx and dy units:
 dy div round cvi /y2 ED     % y2
 dx div round cvi /x2 ED     % x2
 dy div round cvi /y1 ED     % y1
 dx div round cvi /x1 ED     % x1
 /h y2 y1 sub 0 gt { 1 } { -1 } ifelse def  % Sign of y2-y1
 /w x2 x1 sub 0 gt { 1 } { -1 } ifelse def  % Sign of x2-x1
% Set up the font and a few parameters for making labels:
 b 0 gt
 { /z1 b 4 div CLW 2 div add def
   /Helvetica findfont b scalefont setfont
   /b b .95 mul CLW 2 div add def }
 if
% If Level 2, use automatic stroke adjustment. Otherwise, do by hand:
 systemdict /setstrokeadjust known  % Level 2
 { true setstrokeadjust /t { } def }
 { /t {
     transform
     0.25 sub round 0.25 add exch
     0.25 sub round 0.25 add exch
     itransform
   } bind def }
 ifelse
% Now make the vertical lines:
 gsave
% Make dotted line, if appropriate
   n 0 gt
   { 1 setlinecap [ 0 dy n div ] dy n div 2 div setdash }
   { 2 setlinecap }
   ifelse
% Initialize index:
   /i x1 def
% Find y-values of endpoints. Adjust these if lines are dotted because
% otherwise rounding errors or stroke adjustment can cause first or
% last dot to be dropped. (Only GhostScript has exhibited problem of
% dropping first dot. This is probably a bug.)
   /f y1 dy mul n 0 gt { dy n div 2 div h mul sub } if def
   /g y2 dy mul n 0 gt { dy n div 2 div h mul add } if def
% Number of lines (Max 1000):
   x2 x1 sub w mul 1 add dup 1000 gt { pop 1000 } if
   {
% Make label:
     i dx mul dup y0 moveto
     b 0 gt
     { gsave
         c                       % Color
         i a cvs dup             % Index, as a string
         stringwidth pop /z2 ED  % Stringwidth
         w 0 gt {z1} {z1 z2 add neg} ifelse
         h 0 gt {b neg} {z1} ifelse
         rmoveto
         show
       grestore
     } if
% Make line ( on stack: i dx mul ):
     dup t f moveto g t L stroke
% Advance index:
     /i i w add def
   } repeat
 grestore
% Now make horizontal lines:
 gsave
   n 0 gt
   { 1 setlinecap [ 0 dx n div ] dy n div 2 div setdash }
   { 2 setlinecap }
   ifelse
   /i y1 def
   /f x1 dx mul n 0 gt { dx n div 2 div w mul sub } if def
   /g x2 dx mul n 0 gt { dx n div 2 div w mul add } if def
   y2 y1 sub h mul 1 add dup 1000 gt { pop 1000 } if
   { newpath
     i dy mul dup x0 exch moveto
     b 0 gt
     { gsave
         c
         i a cvs dup
         stringwidth pop /z2 ED
         w 0 gt {z1 z2 add neg} {z1} ifelse
         h 0 gt {z1} {b neg} ifelse
         rmoveto
         show
       grestore
     } if
     dup f exch t moveto g exch t L stroke
     /i i h add def
   } repeat
 grestore>

% 7.
\def\overlaybox{%
 \global\setbox\theoverlaybox=\hbox\bgroup
   \begingroup
   \let\psoverlay\pst@overlay
   \def\overlaybox{%
     \@pstrickserr{Overlays cannot be nested}\@eha}%
   \def\putoverlaybox{%
     \@pstrickserr{You must end the overlay box
     before using \string\putoverlaybox}}%
   \psoverlay{main}%
   \ignorespaces}

% 8 and 9.
\pst@def{BeginOL}<%
 dup (all) eq exch TheOL eq or
 { IfVisible not { Visible /IfVisible true def } if }
 { IfVisible { Invisible /IfVisible false def } if }
 ifelse>
\pst@def{InitOL}<%
 /OLUnit [ 3000 3000 matrix defaultmatrix dtransform ] cvx def
 /Visible { CP OLUnit idtransform T moveto } def
 /Invisible { CP OLUnit neg exch neg exch idtransform T moveto } def
 /BOL { \tx@BeginOL } def /IfVisible true def>
\def\AltOverlayMode{%
 \def\pst@initoverlay##1{%
   \pst@Verb{%
     \tx@InitOL
     /Visible { initclip } def
     /Invisible {
       CP newpath OLUnit itransform moveto clip newpath moveto
     } def
     /TheOL (##1) def}}}

% 10.
\def\SpecialCoor{%
 \def\pst@@getcoor##1{%
   \begingroup
     \pst@activecoor
     \xdef\pst@tempg{##1}%
   \endgroup
   \expandafter\special@coor\pst@tempg||\@nil}%
 \def\pst@@getangle##1{%
   \begingroup
     \pst@activecoor
     \xdef\pst@tempg{##1}%
   \endgroup
   \expandafter\special@angle\pst@tempg\@empty)\@nil}%
 \def\psput@##1{\pst@@getcoor{##1}\leavevmode\psput@special}}
\begingroup
 \catcode`\|=13
 \catcode`\;=13
 \catcode`\!=13
 \gdef\pst@activecoor{%
   \def|{\string|}%
   \def;{\string;}%
   \def!{\string!}}
\endgroup
\begingroup
 \catcode`\:=13
 \gdef\pst@activerot{\def:{\string:}}
\endgroup
\def\psset@nrot#1{%
 \begingroup
   \pst@activerot
   \pst@expandafter{\@ifnextchar:{\psset@@nrot}{\psset@@rot}}{#1}\@nil
   \global\let\pst@tempg\psk@rot
 \endgroup
 \let\psk@nrot\pst@tempg}

% 13. See 1.

% 15.
\pst@def{DashLine}<%
 % "a" is set to the length of first and last black segment, as fraction of
 % usual black segment.
 dup 0 gt
 { /a .5 def \tx@PathLength exch div }
 { pop /a 1 def \tx@PathLength }
 ifelse
 /b ED             % Pattern should fit evenly in b
 /x ED             % Length of white segment.
 /y ED             % Length of black segment.
 /z y x add def    % Total length of dash pattern.
 % If pattern  is repeated n times, total length is (nz + 2(a-.5)y).
 % Set length to b, solve for n, round, and leave on stack:
 %   n = round((b - 2(a-.5)y)/z)
 b a .5 sub 2 mul y mul sub z \tx@Div round
 % Adjust x and y by factor k so that
 %   (n(kz) + 2(a-.5)(ky)) = b.
 % Solve for k and leave two copies on stack:
 %   k = b/(nz + 2(a-.5)y)
 z mul a .5 sub 2 mul y mul add b exch \tx@Div dup
 % Scale x and y, set dash, and stroke:
 y mul /y ED x mul /x ED
 % Make sure x and y are both positive:
 x 0 gt y 0 gt and
 { [ y x ] 1 a sub y mul }
 { [ 1 0 ] 0 }
 ifelse
 setdash
 stroke>

% 16.
\def\psclipbox{\@ifnextchar[{\psclipbox@}{\psclipbox@[\z@]}}
\def\psclipbox@[#1]{\pst@makebox\psclipbox@@{#1}}

% 20.
\def\mixed@coor#1#2{%
   \begingroup
     \special@@coor#1;;\@nil
     \let\pst@tempa\pst@coor
     \special@@coor#2;;\@nil
     \xdef\pst@tempg{\pst@tempa pop \pst@coor exch pop }%
   \endgroup
   \let\pst@coor\pst@tempg}

% 23.
\def\pst@getscale#1#2{%
 \edef\pst@tempg{#1}%
 \ifx\pst@tempg\@none
   \def#2{}%
 \else
   \pst@expandafter\pst@getnumii{#1 #1} {} {} {}\@nil
   \ifdim\pst@tempg\p@=\z@
     \@pstrickserr{Bad scaling argument `#1'}\@ehpa
     \def#2{}%
   \else
     \ifdim\pst@temph\p@=\z@
       \@pstrickserr{Bad scaling argument `#1'}\@ehpa
       \def#2{}%
     \else
       \edef#2{\pst@tempg\space \pst@temph\space scale }%
     \fi
   \fi
 \fi}

\catcode`\@=\TheAtCode\relax
\endinput
%% END pstricks.bug