Seite 1 von 1

Pfeil soll sichtbar neben einem node starten (tikzpicture)

Verfasst: Mo 20. Okt 2014, 18:52
von Flo Rida
Hallo,

ich habe mir ein Atommodel gebastelt, bei diesem soll der "gewellte" Pfeil mit etwas Abstand vom node k1 starten. Habe schon mit near start und (level)distance herumprobiert. Leider ohne Erfolg. Hier mein Code:
\documentclass[a4paper]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,decorations.markings}

\begin{document} 

\begin{tikzpicture}[>=latex]
%Kern
\node at (0,0) [shape=circle,ball color=gray!20](kern){+};
%K-Schale
\draw[postaction=decorate,decoration={markings,
 mark=at position .25 with {\node[shape=circle,ball color=gray!20](k1){-};},
 mark=at position .6 with {\node[shape=circle,ball color=gray!20](k2){-};}
 }](0,0)circle(1cm);
%L-Schale
\draw[postaction=decorate,decoration={markings,
 mark=at position .2 with {\node[shape=circle,ball color=gray!20](hub){-};},
 mark=at position .05 with {\node[shape=circle,ball color=gray!20](l1){-};},
 mark=at position .45 with {\node[shape=circle,ball color=gray!20](l2){-};},
 mark=at position .7 with {\node[shape=circle,ball color=gray!20](l3){-};},
 mark=at position .9 with {\node[shape=circle,ball color=gray!20](l4){-};}
 }](0,0)circle(2cm);
%freies Elektron
\node at (-3,2)[shape=circle,ball color=gray!20](e){-};
%Pfeile
\draw[->](e)--(k1)node[midway,above,sloped]{$\vec{F}$};
\draw[->](k1)to[bend left](hub);
\draw[->](hub)to[bend left](k1);
\draw[->,decorate,decoration={snake,amplitude=.4mm,segment length=3mm,post length=3mm},thick](k1)--(3,1.5)node[midway,above,sloped]{$W=h\cdot f$};
\end{tikzpicture}

\end{document}
Wie bekomme ich das hin?

Liebe Grüße
Flo Rida

Verfasst: Di 21. Okt 2014, 00:47
von esdd
Ergänze pre=moveto und pre length=3mm bei der Festlegung der Dekoration:
\documentclass{scrartcl} 
\usepackage{tikz} 
\usetikzlibrary{decorations.pathmorphing,decorations.markings} 
\begin{document} 
\begin{tikzpicture}[
    >=latex,
    ep/.style={circle, ball color=gray!20}%Stil für die Elektronen und Protonen
  ] 
%Kern 
\node at (0,0) [ep](kern){+}; 
%K-Schale 
\draw[postaction=decorate,decoration={markings, 
  mark=at position .25 with {\node[ep](k1){-};}, 
  mark=at position .6 with {\node[ep](k2){-};} 
  }](0,0)circle(1cm); 
%L-Schale 
\draw[postaction=decorate,decoration={markings, 
  mark=at position .2 with {\node[ep](hub){-};}, 
  mark=at position .05 with {\node[ep](l1){-};}, 
  mark=at position .45 with {\node[ep](l2){-};}, 
  mark=at position .7 with {\node[ep](l3){-};}, 
  mark=at position .9 with {\node[ep](l4){-};} 
  }](0,0)circle(2cm); 
%freies Elektron 
\node at (-3,2)[ep](e){-}; 
%Pfeile 
\draw[->](e)--(k1)node[midway,above,sloped]{$\vec{F}$}; 
\draw[->](k1)to[bend left](hub); 
\draw[->](hub)to[bend left](k1);
\draw[->,decorate,
  decoration={snake,amplitude=.4mm,segment length=3mm,post length=3mm,
    pre=moveto,pre length=3mm},
  thick](k1)--(3,1.5)node[midway,above,sloped]{$W=h\cdot f$}; 
\end{tikzpicture} 
\end{document}
Gruß
Elke