Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

What is the equivalent of the pstricks command \psecurve in tikz?

The yellow line is the \psecurve. It's basically the same as the \pscurve: the curve is defined by all the named points, but is not drawn to the end points.

\documentclass{article}
\usepackage{pstricks}
\pagestyle{empty}
\begin{document}

\begin{pspicture}(0,-3)(5,5)
   \pscurve[linewidth=5pt,arrows=<->](0,0)(2,3)(4,-3)(2,5)(1,0)
  \psecurve[linewidth=1.5pt,linecolor=yellow](0,0)(2,3)(4,-3)(2,5)(1,0)
\end{pspicture}

\end{document}

enter image description here

share|improve this question

1 Answer 1

You can use my style between style (from TikZ: Thick curve segment in a curve):

enter image description here

\documentclass[margin=2mm]{standalone}
\usepackage{tikz}
\usepackage{ifthen}
\usetikzlibrary{decorations.pathreplacing,decorations.markings}
\newcounter{pos}
\tikzset{
  initcounter/.code={\setcounter{pos}{0}},
  style between/.style n args={3}{
    postaction={initcounter, decorate,
      decoration={show path construction, curveto code={
          \addtocounter{pos}{1}
          \pgfmathtruncatemacro{\min}{#1 - 1}
          \ifthenelse{\thepos < #2 \AND \thepos > \min}{
            \draw[#3]
            (\tikzinputsegmentfirst) .. controls
               (\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb)
            .. (\tikzinputsegmentlast);
          }{}
        }
      }
    },
  },
}
\begin{document}
\begin{tikzpicture}[line join=round]
  \draw[line width=5pt,<->]
  (0,0) to[out=70,in=180] (2,3) to[out=0,in=180] (4,-3)
  to [out=0,in=0] (2,5) to[out=180,in=100] (1,0);

  \path [style between={2}{4}{line width=1.5pt,yellow}]
  (0,0) to[out=70,in=180] (2,3) to[out=0,in=180] (4,-3)
  to [out=0,in=0] (2,5) to[out=180,in=100] (1,0);
\end{tikzpicture}
\end{document}
share|improve this answer
    
Could you explain how this works at all? –  A.Ellett Feb 19 '13 at 0:33
    
@A.Ellett Look at the show path construction decoration into the pgf manual. –  Paul Gaborit Feb 19 '13 at 0:38
    
That's what I've been doing. It still looks like magic to me. –  A.Ellett Feb 19 '13 at 0:43
    
The default arrow head of TikZ is not as sharp as that of PSTricks. (But it is not the point here) –  stalking is prohibited Feb 19 '13 at 2:09
1  
@GarbageCollector TikZ \neq PSTricks. You may use >=stealth... –  Paul Gaborit Feb 19 '13 at 7:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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