4

I have the following TikZ picture

Red arrow inserted with 3rd party software

Just without the red arrow. I can't figure out how to insert that red arrow with LaTeX.

Here's the code I have so far (I commented some straight arrows out, which is my temporary solution):

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{smartdiagram}

\usepackage{tikz}
\usetikzlibrary{arrows.meta, positioning}

\begin{document}
\begin{tikzpicture}[auto]  
\tikzset{
    mynode/.style={rectangle,rounded corners, draw=gray, top color=white,
                   bottom color=teal!50!gray,very thick, inner sep=1em,
                   minimum size=1em, text centered, minimum width=2cm, 
                   drop shadow, text width=2cm},
    myright/.style={-{Stealth[length=4mm]}, color=gray, line width=0.1cm,
                   draw, shorten <=0.3cm,shorten >=0.3cm, bend right},
    myleft/.style={-{Stealth[length=4mm]}, color=gray, line width=0.1cm, 
                   draw, shorten <=0.3cm,shorten >=0.3cm, bend left},
    straight/.style={-{Stealth[length=4mm]}, color=gray, line width=0.1cm, 
                   draw, shorten <=0.2cm,shorten >=0.2cm},
}

\node[mynode] (ex) {Exekutive Kontrolle};
\node[mynode] at ([yshift=-2.75cm] 0:3cm) (b) {B};
\node[mynode] at ([yshift=-2.75cm] 180:3cm) (em) {A};
\node[mynode] at ([yshift=-3.1cm] 90:0) (a) {{Emotions- regulation}};
\node[mynode] at ([yshift=3.5cm] 0:2.75cm) (akzeptanz) {Akzeptanz};
\node[mynode] at ([yshift=3.5cm] 90:2.75cm) (achtsamkeit) {Achtsamkeit};
\node[mynode] at ([yshift=3.5cm] 180:2.75cm) (awareness) {Awareness};

\path[straight] (ex) to (b);
\path[straight] (ex) to (a);
\path[straight] (ex) to (em);
%\path[straight] (akzeptanz) to (ex);
%\path[straight] (awareness) to (ex);
\path[straight] (achtsamkeit) to (akzeptanz);
\path[straight] (achtsamkeit) to (awareness);
\path[myleft] (akzeptanz) to (awareness);
\path[myleft] (awareness) to (akzeptanz);
\end{tikzpicture} 

\end{document}

I'd really appreciate if anybody could extend this code so it contains the red arrow in my screenshot as a straight arrow according to the other ones.

2
  • Welcome to TeX.SE! Please, complete your code sniped at least with used library. Even better make from it complete document started with \documentclass{...} <used packages and libraries> \begin{document} ... \end{document}
    – Zarko
    Jun 21, 2016 at 21:34
  • Sorry, done. Hope now it looks like it's supposed to look like. Jun 21, 2016 at 21:39

1 Answer 1

3

Like this?

enter image description here

Code:

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{smartdiagram}

\usepackage{tikz}
\usetikzlibrary{arrows.meta, positioning}


\begin{document}
\begin{tikzpicture}[auto]
\tikzset{
    mynode/.style={rectangle,rounded corners, draw=gray, top color=white,
                   bottom color=teal!50!gray,very thick, inner sep=1em,
                   minimum size=1em, text centered, minimum width=2cm,
                   drop shadow, text width=2cm},
    myright/.style={-{Stealth[length=4mm]}, color=gray, line width=0.1cm,
                   draw, shorten <=0.3cm,shorten >=0.3cm, bend right},
    myleft/.style={-{Stealth[length=4mm]}, color=gray, line width=0.1cm,
                   draw, shorten <=0.3cm,shorten >=0.3cm, bend left},
    straight/.style={-{Stealth[length=4mm]}, color=gray, line width=0.1cm,
                   draw, shorten <=0.2cm,shorten >=0.2cm},
}

\node[mynode] (ex) {Exekutive Kontrolle};
\node[mynode] at ([yshift=-2.75cm] 0:3cm) (b) {B};
\node[mynode] at ([yshift=-2.75cm] 180:3cm) (em) {A};
\node[mynode] at ([yshift=-3.1cm] 90:0) (a) {{Emotions- regulation}};
\node[mynode] at ([yshift=3.5cm] 0:2.75cm) (akzeptanz) {Akzeptanz};
\node[mynode] at ([yshift=3.5cm] 90:2.75cm) (achtsamkeit) {Achtsamkeit};
\node[mynode] at ([yshift=3.5cm] 180:2.75cm) (awareness) {Awareness};

\path[straight] (ex) to (b);
\path[straight] (ex) to (a);
\path[straight] (ex) to (em);
%\path[straight] (akzeptanz) to (ex);
%\path[straight] (awareness) to (ex);
\path[straight] (achtsamkeit) to (akzeptanz);
\path[straight] (achtsamkeit) to (awareness);
\path[myleft] (akzeptanz) to coordinate (x) (awareness); <-- added coordinate
\path[myleft] (awareness) to (akzeptanz);

\draw[red, shorten <=2mm, shorten >=1mm,    % <-- new
      line width=2mm, -{Stealth[length=6mm,width=6mm]}] (x) -- (ex);
\end{tikzpicture} 
\end{document}

Addendum: As mentioned in comments to this answer, let me show an alternative, slightly more concise code for above picture. In it I consider:

  • the picture is pure TikZ picture, so for it the package smartdiagram is surplus; instead should be add TikZ librtary shodows
  • all nodes have the same style, so it is sensible to define style for every node
  • instead of diferent shorten of arrows can be used bigger outer sep of nodes and
  • instead of -- use edge; by this is not neccessary to repat \draw or used \pat for each arrow.

Complete code:

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{tikz}
\usetikzlibrary{arrows.meta, positioning, shadows}

\begin{document}
\begin{tikzpicture}[
    node distance = 13mm and 0mm,
every node/.style = {rectangle, rounded corners, draw=gray, very thick, 
                     top color=white, bottom color=teal!50!gray, 
                     inner sep=1em, outer sep=1.5mm,
                     text width=20mm, align=center,
                     drop shadow},
  myarrows/.style = {draw=#1, line width=1mm, -{Stealth[length=4mm]}},
myarrows/.default = gray
                    ]
\node (ex) {Exekutive Kontrolle};
\node (a) [below  left=of ex] {A};
\node (em)[below      =of ex] {Emotions- regulation};
\node (b) [below right=of ex] {B};
%
\node (awareness)   [above  left=of ex]  {Awareness};
\node (akzeptanz)   [above right=of ex]  {Akzeptanz};
\node (achtsamkeit) 
    [above right=of awareness] {Achtsamkeit};

\draw[myarrows] (ex) edge (a) (ex) edge (em) (ex) edge (b)
                (achtsamkeit) edge (akzeptanz)
                (achtsamkeit)  to  (awareness);
\draw[myarrows, bend left] 
    (awareness.north east) edge (akzeptanz.north west)
    (akzeptanz.south west)  to  coordinate (x) (awareness.south east);%<-- added coordinate
%
\draw[myarrows=red,shorten <=2mm] (x) -- (ex);% <-- new
\end{tikzpicture}
\end{document}
6
  • Yes, the position is perfect! Thank you very much! I'll adjust the style of it myself, since I need it to match the other ones. Jun 21, 2016 at 21:54
  • I didn't interfere in your code regardles that to my opinion, can be written more concise. In this picture you don't nedd package {smartdiagram since picture is pure TukZ drawing. You only need to add library shadows. And since all nodes are the same, their style can be defined as for every node/.style. In node style is also sufficient to define minimum height=1em and text width=2cm and omit minimum width ...
    – Zarko
    Jun 21, 2016 at 22:25
  • Thanks! I will check out these changes. Next time feel free to adjust the code, please! I'm always open to suggestions for better code and improvement. Jun 22, 2016 at 11:51
  • o.k., I add one alternative to, more concise code for your picture. See, if it is usable for you.
    – Zarko
    Jun 22, 2016 at 13:54
  • Yes, it's almost perfect. There was just a small typo regarding text width=2mm, with 2cm it's exactly what I wanted it to look like. Seeing this concise version of yours I just realized how much redundant code I had there. Really appreciate your efforts! Jul 15, 2016 at 13:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .