Skip to content

Instantly share code, notes, and snippets.

@drorata
Created November 12, 2013 19:37
Show Gist options
  • Save drorata/7437306 to your computer and use it in GitHub Desktop.
Save drorata/7437306 to your computer and use it in GitHub Desktop.
Place '>' sign aligned with a piecewise linear curve and mark its vertices using decorations. See the discussion in this thread: http://tex.stackexchange.com/q/144584/412
\begin{tikzpicture}[
mnode/.style={circle,draw=black,fill=black,inner sep=0pt,minimum size=2pt},
node at every point/.style={%
decoration={%
show path construction,
lineto code={%
\coordinate (pos) at ($0.5*(\tikzinputsegmentlast)+0.5*(\tikzinputsegmentfirst)$);
\coordinate (direction) at ($(\tikzinputsegmentlast)-(\tikzinputsegmentfirst)$);
\gettikzxy{(direction)}{\dirx}{\diry}
\pgfmathsetmacro\rotationdir{atan(\diry/\dirx)}
\node at (pos) [rotate=\rotationdir] {>};
\node at (\tikzinputsegmentlast) [#1] {};
},
moveto code={\node at (\tikzinputsegmentfirst) [#1] {};},
curveto code={\node at (\tikzinputsegmentlast) [#1] {};}
},
postaction=decorate
}
]
\draw[node at every point=mnode] (0,0) -- (1,2) -- (2.3,0) -- (2.5,1);
\end{tikzpicture}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment