Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \documentclass[tikz,border=5pt]{standalone}
- \usetikzlibrary{decorations.markings}
- \usepackage{ifthen}
- \newcommand{\forloop}[5][1]%
- {%
- \setcounter{#2}{#3}%
- \ifthenelse{#4}%
- {%
- #5%
- \addtocounter{#2}{#1}%
- \forloop[#1]{#2}{\value{#2}}{#4}{#5}%
- }%
- % Else
- {%
- }%
- }%
- \newcounter{ct}
- \setcounter{ct}{1}
- \newcommand{\arrowN}[1]{%
- \forloop{ct}{1}{\value{ct} < #1}%
- {%
- \pgfmathparse{\arabic{ct}/(1+#1)}\pgfmathresult,
- }%
- \pgfmathparse{\arabic{ct}/(1+#1)}\pgfmathresult
- \setcounter{ct}{1}}
- \tikzset{
- set arrow inside/.code={\pgfqkeys{/tikz/arrow inside}{#1}},
- set arrow inside={end/.initial=>, opt/.initial=},
- /pgf/decoration/Mark/.style={
- mark/.expanded=at position #1 with
- {
- \noexpand\arrow[\pgfkeysvalueof{/tikz/arrow inside/opt}]{\pgfkeysvalueof{/tikz/arrow inside/end}}
- }
- },
- arrow inside/.style 2 args={
- set arrow inside={#1},
- postaction={
- decorate,decoration={
- markings,Mark/.list={#2}
- }
- }
- },
- }
- \begin{document}
- \arrowN{3}
- \clearpage
- \begin{tikzpicture}
- \begin{scope}[scale=2]
- \node[label=below:$A$] (A) at (0,0) {};
- \node[label=below:$B$] (B) at (2,0.25){};
- \draw plot [smooth,tension=1]
- coordinates {(A) (1,0) (1.14,-0.6) (0.5,-0.5) (0.5,0.5) (1.5,0) (B)}
- [red,arrow inside={end=stealth,opt={scale=2}}{0.25, 0.5, 0.75}];
- \draw [black] plot [smooth,tension=1]
- coordinates {(A) (1,0) (1.14,-0.6) (0.5,-0.5) (0.5,0.5) (1.5,0) (B)};
- \end{scope}
- \draw [fill=black] (A) circle (1pt);
- \draw [fill=black] (B) circle (1pt);
- \end{tikzpicture}
- \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement