# Self Intersecting Diagrams, PSTricks

Okay, so I have a self-intersecting curve drawn using \pscurve in PSTricks, and I would like the interestions to look something like -|- as opposed to +. I know it can be done using double lines in TikZ, but is there a similar method or style option in PSTricks.

\documentclass[a4paper]{article}
\usepackage{pstricks}
\usepackage{pst-plot}
\begin{document}
\begin{pspicture}(0,3)(10,-5)
\pscurve[linewidth=2pt](0.1,-1)(1,2)(2,3)(3,2)(4,0)(3,-2)(2,-3)(1,-2)(0,1)(-1,-‌​1)(0,-2)(2,-2)(4,-2)(3,0)(4,2)(2,2)(0,2)(-1,1)(-0.1,-1)
\end{pspicture}
\end{document}

• Could we have you code, or the curve equation, so that we can test? – Bernard Jun 26 '14 at 10:02
• Sure, sorry.\documentclass[a4paper]{article} \usepackage{pstricks} \usepackage{pstricks-add} \usepackage{pst-plot} \begin{document} \begin{pspicture}(0,3)(10,-5) \pscurve[linewidth=2pt](0.1,-1)(1,2)(2,3)(3,2)(4,0)(3,-2)(2,-3)(1,-2)(0,1)(-1,-1)(0,-2)(2,-2)(4,-2)(3,0)(4,2)(2,2)(0,2)(-1,1)(-0.1,-1) \end{pspicture} \end{document} – A. W Jun 26 '14 at 10:09

You can use the pst-intersect package for this. First you must save the path produced by \pscurve with \pssavepath. Then you retrace the saved path piece by piece firt with a wider white stroke and then with a smaller black stroke. That works as long as the individual path elements don't intersect themselves. Unfortunately you must estimate the number of path segments yourself:

\documentclass[pstricks, margin=12pt]{standalone}
\usepackage{multido, pst-intersect}
\begin{document}
\begin{pspicture}(-1,-3)(4,3)
\pssavepath[linestyle=none]{A}{%
\pscurve(0.1,-1)(1,2)(2,3)(3,2)(4,0)(3,-2)(2,-3)(1,-2)(0,1)(-1,-1)(0,-2)(2,-2)(4,-2)(3,0)(4,2)(2,2)(0,2)(-1,1)(-0.1,-1)}
\multido{\i=0+1,\ii=1+1}{18}{%
\pstracecurve[tstart=\i,tstop=\ii, linecolor=white, linewidth=4pt]{A}
\pstracecurve[tstart=\i,tstop=\ii, linecolor=black, linewidth=2pt]{A}}
\end{pspicture}
\end{document}