Uncontinuous curves

Denis Girou Denis.Girou at idris.fr
Tue May 11 12:22:44 CEST 1999


-----------------------------------------------------------------------------
This is the PSTricks mailing list, devoted to discussions about computational
graphics in (La)TeX using the PSTricks package from Timothy van Zandt.
For help using this mailing list, see instructions at the end of message.
-----------------------------------------------------------------------------

>>>>> "Nicolas.Francois" == Nicolas FRANCOIS <nicofran at club-internet.fr> writes:

    Nicolas.Francois> Hi. I would like to draw scale functions with discontinuities, using lines
    Nicolas.Francois> with a half-circle at the end. How should I replace the >-< option to
    Nicolas.Francois> achieve this ?

  The solution given by Eddie Saudrais answer to the question asked and give
a good result.

  But, as he said, if you want a clean solution and to avoid to must add some
extra \psline commands just to draw the connectors, you must define a )-( type
arrow.

  In fact, it is trivial to do, following the TeX and PostScript codes for the
(-) arrow. Some years ago, I have done for somebody else the same thing for the
]-[ arrow (in fact, it was not very correct at this time, as it didn't behave
correctly if we change bracketlength for instance, but I just correct it...).

  Nevertheless, I don't test extensively the code...

\documentclass{article}

\usepackage{pstricks}

\setlength{\oddsidemargin}{0cm}
\setlength{\parindent}{0cm}

\pagestyle{empty}

\makeatletter

% D.G. modification begin - Oct. 25, 1996 and May. 11, 1999

\def\pst at arrowtable{,<->,<<->>,>-<,>>-<<,(-),)-(,[-],]-[}

% ]-[ arrow
\def\tx at BracketOut{BracketOut }
\@namedef{psas@[}{%
/BracketOut {%
CLW mul add dup CLW sub 2 div
%/x ED mul CLW add
/x ED mul neg
/y ED
/z CLW 2 div def
x neg y moveto
x neg CLW 2 div L x CLW 2 div L x y L stroke 0 CLW moveto } def
\psk at bracketlength \psk at tbarsize \tx at BracketOut}

% )-( arrow
\def\tx at RoundBracketOut{RoundBracketOut }
\@namedef{psas@(}{%
/RoundBracketOut {%
CLW mul add dup 2 div
%/x ED mul 
/x ED mul neg
/y ED
/mtrx CM def
0 CLW
2 div T x y mul 0 ne { x y scale } if
1 1 moveto
.85 .5 .35 0 0 0 curveto
-.35 0 -.85 .5 -1 1 curveto
mtrx setmatrix stroke 0 CLW moveto } def
\psk at rbracketlength \psk at tbarsize \tx at RoundBracketOut}

% D.G. modification end

\makeatother

\begin{document}

\begin{pspicture}(9,4)
  \psset{linewidth=0.1}
  \psline{[-]}(0,3)(4,3)
  \psline{]-[}(0,2)(4,2)
  \psline{(-)}(0,1)(4,1)
  \psline{)-(}(0,0)(4,0)
%
  \psset{arrowscale=1.5,bracketlength=0.5,rbracketlength=0.5}
  \psline{[-]}(5,3)(9,3)
  \psline{]-[}(5,2)(9,2)
  \psline{(-)}(5,1)(9,1)
  \psline{)-(}(5,0)(9,0)

\end{pspicture}

\vspace{1cm}

% From: Nicolas FRANCOIS <nicofran at club-internet.fr>
% To: pstricks at tug.org
% Subject: Uncontinuous curves
% Date: Tue, 11 May 1999 00:18:39 +0200

 \begin{tabular}{p{8cm}p{8cm}}
   \begin{pspicture}(8,5)
   \psline{->}(0.5,2.5)(7.5,2.5)
   \psline{->}(4,0.5)(4,4.5)
   \psline[linewidth=0.5mm]{-<}(0.5,0.93)(4,0.93)
   \psline[linewidth=0.5mm]{>-}(4,4.07)(7.5,4.07)
   \psdots[dotstyle=*,dotsize=4pt 2](4,2.5)
   \rput(3.7,4.07){$\frac{\pi}{2}$}
   \rput(4.3,0.93){$-\frac{\pi}{2}$}
   \end{pspicture}
  &
   \begin{pspicture}(8,5)
   \psline{->}(0.5,1)(7.5,1)
   \psline{->}(4,0.5)(4,4.5)
   \psline[linewidth=0.5mm]{-<}(0.5,1)(2,1)
   \psline[linewidth=0.5mm]{>-}(6,1)(7.5,1)
   \psline[linewidth=0.5mm]{>-<}(2,4.14)(6,4.14)
   \psdots[dotstyle=*,dotsize=4pt 2](2,2.5)(6,2.5)
   \rput(4.3,2.5){$\frac{\pi}{4}$}
   \rput(4.3,4.5){$\frac{\pi}{2}$}
   \end{pspicture}
 \end{tabular}

% The same, with -( and )- arrows

 \begin{tabular}{p{8cm}p{8cm}}
   \begin{pspicture}(8,5)
   \psline{->}(0.5,2.5)(7.5,2.5)
   \psline{->}(4,0.5)(4,4.5)
   \psline[linewidth=0.5mm]{-(}(0.5,0.93)(4,0.93)
   \psline[linewidth=0.5mm]{)-}(4,4.07)(7.5,4.07)
   \psdots[dotstyle=*,dotsize=4pt 2](4,2.5)
   \rput(3.7,4.07){$\frac{\pi}{2}$}
   \rput(4.3,0.93){$-\frac{\pi}{2}$}
   \end{pspicture}
  &
   \begin{pspicture}(8,5)
   \psline{->}(0.5,1)(7.5,1)
   \psline{->}(4,0.5)(4,4.5)
   \psline[linewidth=0.5mm]{-(}(0.5,1)(2,1)
   \psline[linewidth=0.5mm]{)-}(6,1)(7.5,1)
   \psline[linewidth=0.5mm]{)-(}(2,4.14)(6,4.14)
   \psdots[dotstyle=*,dotsize=4pt 2](2,2.5)(6,2.5)
   \rput(4.3,2.5){$\frac{\pi}{4}$}
   \rput(4.3,4.5){$\frac{\pi}{2}$}
   \end{pspicture}
 \end{tabular}

\end{document}

D.G.

-----------------------------------------------------------------------------
The list interface (subscription, information, access to the archives) is on:
http://www.tug.org/cgi-bin/lwgate/pstricks
Otherway to unsubscribe, send mail to pstricks-request at mail.tug.org
with a blank subject and in body the line unsubscribe <email-address>
-----------------------------------------------------------------------------



More information about the PSTricks mailing list