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.

The initial code is

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations} 
\usetikzlibrary{decorations.markings}
\begin{document}

\pgfkeys{
/pgf/decoration/.cd,
pre fraction/.style={pre length=#1*\pgfmetadecoratedpathlength},
post fraction/.style={post length=#1*\pgfmetadecoratedpathlength}
}

\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (4,2);

\draw [  
decoration={ 
curveto,
pre=moveto, pre fraction=0,
post=moveto, post fraction=0.3}, decorate, red, ultra thick] (A) to[out=0,in=-90](B);

\draw [decoration={curveto,
                   pre=moveto, pre fraction=0.7,
                   post=moveto, post fraction=0},%
       decorate, blue, ultra thick,dotted] (A) to [out=0,in=-90](B); 

\path [  
decoration={ 
     markings, mark=at position .7  with {\arrow[red,line width=2pt]{>}}},  
     decorate  ] (A) to[out=0,in=-90](B);         
\end{tikzpicture} 

\end{document}

enter image description here

There is a problem if I want to replace to by edge . In some cases, the replacement is useful.

Is it possible to use making with edge ? and how ?

I think that the problem comes from that the edge operation works like a to operation that is added after the main path has been drawn. I get often the error that marking does not work on an empty path !

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

Finally I found the answer here: texblog.net in the article: Decorate a TikZ path. (Author: Stefan Kottwitz thanks!). I do not know why I did not think earlier. There are many questions related to the use of edge that can be resolved like this, example: Strange arrow mark with TikZ edge and anchors.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations} 
\usetikzlibrary{decorations.markings}
\begin{document}

\begin{tikzpicture}
  \tikzset{every loop/.style={min distance=20mm,in=0,out=60,looseness=10}} 

   \draw (0,0) node[circle,draw]{A} edge[red,loop]  ();    
 \path[decoration={ 
     markings, mark=at position .7  with {\arrow[blue,line width=1pt]{>}}}] (0,0) node[circle]{A} edge[decorate,loop]  ();
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
add comment

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.