Überarbeitungsverlauf[Zurück]
Klicke auf Einblenden/Ausblenden von Überarbeitungen 2

05 Jul '18, 14:16

cis's gravatar image

cis
9.5k96460491

TikZ: Wie kann ich den Node-Pfeil 'single arrow' so anpassen, dass er zwischen zwei Koordinaten gezeichnet wird?

`Verwandt mit: ` https://texwelt.de/wissen/fragen/22338/tikz-feinschliff-einer-pfeilspitze ___ Ich möchte ein Kommando erstellen, dass es erlaubt einen `single arrow` aus der `shapes`-Bibliothek zwischen zwei Koordinaten, etwa `A` und `B`, zu zeichnen. Dazu habe ich Winkel und Abstand der Koordinaten berechnet. Der Winkel ist schonmal der richtige, aber die Länge des Pfeils scheint nahezu die Richtige zu sein. Aber mit dem Abstand bzw. der Spezifikation Position des Pfeils stimmt etwas nicht. [![alt text][1]][1] \documentclass[margin=5mm]{standalone} \usepackage{amsmath, amssymb} \usepackage{tikz} \usetikzlibrary{shapes} \begin{document} \tikzset{Pfeil/.style={ single arrow, draw, %single arrow tip angle=60, minimum width=5ex, %minimum width=6ex, %minimum height=45ex, height=13ex, inner sep=0ex, %single sep=1ex, %text height=1ex, %text depth=0ex, single arrow head extend=3pt, extend=1ex }} \begin{tikzpicture} \coordinate (A) at (0,0); \coordinate (B) at (2,2); % ... \path (A); \pgfgetlastxy{\Ax}{\Ay} \path (B); \pgfgetlastxy{\Bx}{\By} %\pgfmathsetmacro{\Length}{veclen(\Ax,\By)} \pgfmathsetmacro{\Length}{sqrt((\By-\Ay)^2+(\Bx-\Ax)^2)} \pgfmathsetmacro{\Angle}{atan((\By-\Ay)/(\Bx-\Ax))} \path[] (A) node[Pfeil, rotate=\Angle] {\rule{0ex}{\Length pt}} -- (B); node[ Pfeil, rotate=\Angle, xshift=1*0.5*\Bx, yshift=0*0.5*\By, minimum height=1.0*\Length, %minimum width=1.0*\Bx, ] {}; % Kontrolle \draw[red] (A) -- (B) ; \node \node[red] at (0,5) {\Ax, \Ay, \Bx, \By, \Angle, \Length}; \end{tikzpicture} \end{document} [1]: https://texwelt.de/wissen/upfiles/55555555_173.pnghttps://texwelt.de/wissen/upfiles/55555555_174.png
Klicke auf Einblenden/Ausblenden von Überarbeitungen 1

04 Jul '18, 19:59

cis's gravatar image

cis
9.5k96460491

TikZ: Wie kann ich den Node-Pfeil 'single arrow' so anpassen, dass er zwischen zwei Koordinaten gezeichnet wird?

`Verwandt mit: ` https://texwelt.de/wissen/fragen/22338/tikz-feinschliff-einer-pfeilspitze ___ Ich möchte ein Kommando erstellen, dass es erlaubt einen `single arrow` aus der `shapes`-Bibliothek zwischen zwei Koordinaten, etwa `A` und `B`, zu zeichnen. Dazu habe ich Winkel und Abstand der Koordinaten berechnet. Der Winkel ist schonmal der richtige, aber mit dem Abstand bzw. der Spezifikation des Pfeils stimmt etwas nicht. [![alt text][1]][1] \documentclass[margin=5mm]{standalone} \usepackage{amsmath, amssymb} \usepackage{tikz} \usetikzlibrary{shapes} \begin{document} \tikzset{Pfeil/.style={ single arrow, draw, %single arrow tip angle=60, %minimum width=6ex, %minimum height=45ex, inner sep=0ex, %single arrow head extend=3pt, }} \begin{tikzpicture} \coordinate (A) at (0,0); \coordinate (B) at (2,2); % ... \path (A); \pgfgetlastxy{\Ax}{\Ay} \path (B); \pgfgetlastxy{\Bx}{\By} %\pgfmathsetmacro{\Length}{veclen(\Ax,\By)} \pgfmathsetmacro{\Length}{sqrt((\By-\Ay)^2+(\Bx-\Ax)^2)} \pgfmathsetmacro{\Angle}{atan((\By-\Ay)/(\Bx-\Ax))} \path[] (A) node[Pfeil, rotate=\Angle] {\rule{0ex}{\Length pt}} -- (B); % Kontrolle \draw[red] (A) -- (B) ; \node at (0,5) {\Ax, \Ay, \Bx, \By, \Angle, \Length}; \end{tikzpicture} \end{document} [1]: https://texwelt.de/wissen/upfiles/55555555_173.png

Willkommen, erstes Mal hier? Schau mal unter FAQ!

×