"Arrows" mit tikz

Tabellen und Grafiken erstellen und anordnen


Dimitri
Forum-Guru
Forum-Guru
Beiträge: 418
Registriert: Fr 22. Mär 2013, 16:50

"Arrows" mit tikz

Beitrag von Dimitri »

Hallo zusammen,

ist es möglich, einen Pfeil vom Block rechts unten in die linke Ecke der Raute zu zeichnen (quasi mit zwei rechten Winkeln)?

LG

Dimitri

Minimalbeispiel
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows, shapes.geometric}

\begin{document}
\begin{tikzpicture}
[auto,
block/.style = {rectangle, draw, minimum height = 1cm, text width = 1cm}, align = flush center,
decision/.style = {diamond, draw, text width = 1cm, inner sep = 0.1cm, align = center},
line/.style = {thick, draw, -latex'}]

\matrix[column sep = 5mm, row sep = 5mm]{
& \node [decision] (a) {dec};
& \node [block] (b) {bl1};\\
& & \node [block] (c) {bl2};\\};

\begin{scope} [every path/.style = line]
\path (a) -- (b);
\path (b) -- (c);
\end{scope}
\end{tikzpicture}
\end{document}[/MWE]


Bartman
Forum-Meister
Forum-Meister
Beiträge: 2456
Registriert: Do 16. Jul 2009, 21:41
Wohnort: Hessische Provinz

Re: "Arrows" mit tikz

Beitrag von Bartman »

Ja, es ist möglich, z. B. so:

\begin{scope} [every path/.style = line]
\path (a) -- (b);
\path (b) -- (c);
\path (c) -| ([xshift=-5mm]a.west) -- (a);% oder
%\path (c) -- (c-|a.west) -- +(-0.5,0) |- (a);
\end{scope}

Die Matrix kann man dafür zwar nehmen, aber meines Erachtens dann besser mit den Annehmlichkeiten der gleichnamigen Bibliothek, damit man bspw. auf die \node-Befehle verzichten kann.

In meinem Vorschlag bevorzuge ich die positioning-Bibliothek:

\documentclass[tikz, border=5pt]{standalone}
\usetikzlibrary{arrows.meta,shapes.geometric,positioning}

\begin{document}
\begin{tikzpicture}[
    auto,
    block/.style = {draw, minimum height = 1cm, text width = 1cm}, align = flush center,
    decision/.style = {diamond, draw, text width = 1cm, inner sep = 0.1cm, align = center},
    line/.style = {thick, draw, -Latex}
]

\node [decision] (a) {dec};
\node [block] (b) [right=of a] {bl1};
\node [block] (c) [below=of b] {bl2};

\path [line]
    (a) edge (b)
    (b) edge (c)
    (c) -| ([xshift=-8mm]a.west) -- (a)% oder
%    (c) -- (c-|a.west) -- +(-0.8,0) |- (a)
;
\end{tikzpicture}
\end{document}

Dimitri
Forum-Guru
Forum-Guru
Beiträge: 418
Registriert: Fr 22. Mär 2013, 16:50

Re: "Arrows" mit tikz

Beitrag von Dimitri »

Vielen Dank! :-)


Antworten