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.

  • 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}
  \pstracecurve[tstart=\i,tstop=\ii, linecolor=white, linewidth=4pt]{A}
  \pstracecurve[tstart=\i,tstop=\ii, linecolor=black, linewidth=2pt]{A}}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.