12

If someone could tell me how to draw L-shaped arrows with text inside (as in the image attached)? I'm using node for normal arrows but I don't know how to make them L-shaped.

enter image description here

My code so far:

\documentclass[aspectratio=169]{beamer} 

\mode<presentation>
{
  \usetheme{default}
  \usecolortheme{default}
  \usefonttheme{default}
  \setbeamertemplate{navigation symbols}{}
} 

\usepackage[english]{babel}

\usepackage[utf8x]{inputenc}

\usepackage{bbold} %indicator function

\usepackage{centernot}


%%%% TIKZ STUFF

\usepackage{tikz}

\usetikzlibrary{calc}

\usetikzlibrary{fit,shapes.geometric}

\usetikzlibrary{arrows.meta}

\usetikzlibrary{matrix,shapes,arrows,fit,backgrounds}

\usepackage{booktabs,dcolumn}

\usepackage{tabularx}

\makeatother



\begin{document}

    \tikzset{   
        every picture/.style={remember picture,baseline},
        every node/.style={anchor=base,align=center,outer sep=-1pt},
        every path/.style={thick},
    }
    
    
    \usetikzlibrary {positioning}   


\begin{frame}[label=mechanisms_path]{}

\tikzstyle{block} = [circle, draw, fill=white,]

\tikzstyle{arrow} = [single arrow, rounded corners=2pt, fill=black!20, draw, minimum size=3cm, single arrow head extend=2mm, minimum height=3cm, minimum width=2.5cm]


\begin{tikzpicture}[overlay,remember picture]

\node<1->[arrow,](D) at (9.58,1.81) 

{ 

\tiny  TEXT 

};

\node<1->[block,  text centered, rounded corners,  minimum size=2cm] (E) at (12.8,2) 

{ 

\tiny TEXT 

};

\node<1->[single arrow, rounded corners=2pt, fill=black!20, draw, minimum size=2.38cm, single arrow head extend=2mm, shape border rotate=270, ](F) at (12.8,-0.02) 

{ 

\tiny TEXT 

};

\node<1->[block,  text centered, rounded corners,  minimum size=2cm] (G) at (12.8,-3.65) 

{ 

\tiny TEXT 

};

\node<1->[arrow, shape border rotate=180,](H) at (10,-3.65) 

{ 

\tiny TEXT 

};


\end{tikzpicture}

\end{frame}

\end{document}

I just want the arrows to be L-shaped (like in the image attached).

3
  • Welcome to TeX.SE! Please show us the code you have tried so far ...
    – Mensch
    Aug 5 at 18:47
  • Please don't only post a snippet, but a minimal working example (MWE). It seems that you use some shapes library and beamer? Aug 5 at 20:10
  • Better avoid the utf8x option for inputenc with current latex. utf8 is the default, there aren't many good reasons to use utf8x Aug 6 at 11:59

2 Answers 2

13

A quick and dirty solution with triangles:

\documentclass[aspectratio=169]{beamer} 

\mode<presentation>
{
  \usetheme{default}
  \usecolortheme{default}
  \usefonttheme{default}
  \setbeamertemplate{navigation symbols}{}
} 

\usepackage{tikz}
\usetikzlibrary{shapes.arrows}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{matrix}
\usetikzlibrary {shapes.geometric}

\tikzset{
    block/.style={
        circle, draw, fill=white
        },
    myarrow/.style={
        single arrow, rounded corners=2pt, fill=black!20, draw, minimum size=3cm, single arrow head extend=2mm, minimum height=3cm, minimum width=2.5cm 
        },
    mytri/.style={
        isosceles triangle, anchor=apex,
        isosceles triangle apex angle=90,
        minimum width=50pt
        }
    }
\begin{document}
\begin{frame}\centering
\begin{tikzpicture}
\matrix[matrix of nodes,
nodes={circle, draw,
minimum size=10pt},
ampersand replacement=\&,
row sep=50pt,
column sep=40pt](mymatr){1\&\&[-20pt]2\&[40pt]\\
\&6\&\&3\\
5\&\&4\\};
\draw[->] (mymatr-1-1) -- node[above] {Some} (mymatr-1-3);
\draw[->] (mymatr-1-3) -- node[left] {Some} (mymatr-2-2);
\draw[->] (mymatr-1-3) -- node[right] {Some} (mymatr-3-3);
\draw[->] (mymatr-2-2) -- node[left] {Some} (mymatr-3-3);
\draw[->] (mymatr-3-3) -- node[below] {Some} (mymatr-3-1);
\node[right=0pt of mymatr-1-3,  
minimum height=30pt] (suprec) {};
\node[align=left, anchor=west, font=\footnotesize] at (suprec) {Something\\ something else};
\node[above=0pt of mymatr-2-4, mytri, rotate=-90] (suptri) {};
\coordinate (suptrir) at ([xshift=10pt]suptri.right corner);
\coordinate (suptril) at ([xshift=-10pt]suptri.left corner);
\draw (suptri.apex) -- (suptri.left corner)
(suptri.apex) -- (suptri.right corner)
(suptri.right corner) -- (suptrir)
(suptri.left corner) -- (suptril)
(suprec.south west) -| (suptrir)
(suprec.north west) -| (suptril)
(suprec.south west) -- (suprec.north west);
\node[below=0pt of mymatr-2-4, align=left, 
minimum width=30pt] (infrec) {};
\node[right=0pt of mymatr-3-3, mytri,  rotate=180] (inftri) {};
\coordinate (inftrir) at ([yshift=-10pt]inftri.right corner);
\coordinate (inftril) at ([yshift=10pt]inftri.left corner);
\draw
(infrec.north west) -- (infrec.north east) 
(infrec.north west) |- (inftrir)
(infrec.north east) |- (inftril)
(inftri.apex) -- (inftri.left corner)
(inftri.apex) -- (inftri.right corner)
(inftri.right corner) -- (inftrir)
(inftri.left corner) -- (inftril);
\node[align=left, anchor=north west, text width=26pt, font=\footnotesize] at (infrec.north west) {Some\-thing written here};
\node[align=left, anchor=west, text width=50pt, font=\footnotesize] at (inftri.lower side) {Some\-thing else written here};
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

Edit
All arrows thicker:

\documentclass[aspectratio=169]{beamer} 

\mode<presentation>
{
  \usetheme{default}
  \usecolortheme{default}
  \usefonttheme{default}
  \setbeamertemplate{navigation symbols}{}
} 

\usepackage{tikz}
\usetikzlibrary{shapes.arrows}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{matrix}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{calc}

\tikzset{
    block/.style={
        circle, draw, fill=white
        },
    myarrow/.style={
        single arrow, rounded corners=2pt, fill=black!20, draw, 
        single arrow head extend=2mm, minimum width=30pt,
        font=\footnotesize
        },    
    myar/.style={
        rounded corners=2pt, fill=black!20, 
        },
    mytri/.style={
        isosceles triangle, anchor=apex,
        isosceles triangle apex angle=90,
        minimum width=50pt
        },
    }
    
\begin{document}
\begin{frame}\centering
\begin{tikzpicture}
\matrix[matrix of nodes,
    nodes={circle, draw,
    minimum size=10pt},
    ampersand replacement=\&,
    row sep=50pt,
    column sep=60pt]
    (mymatr)
    {1\&\&[-20pt]2\&[40pt]\\
    \&6\&\&3\\
    5\&\&4\\};
\node[myarrow, anchor=west, minimum height=112pt] at ([xshift=4pt]mymatr-1-1.east) {Some 1};
\coordinate (n2vsn6) at ($(mymatr-1-3)!.85!(mymatr-2-2)$);
\node[myarrow, anchor=tip, minimum height=64pt, rotate around={230:(n2vsn6)}] at (n2vsn6) {\rotatebox{180}{Some 2}};
\coordinate (n6vsn4) at ($(mymatr-2-2)!.85!(mymatr-3-3)$);
\node[myarrow, anchor=tip, minimum height=64pt, rotate around={-50:(n6vsn4)}] at (n6vsn4) {Some 3};
\node[myarrow, anchor=tip, minimum height=112pt, rotate=-90] at ([yshift=4pt]mymatr-3-3.north) {Some 4};
\node[myarrow, anchor=tip, minimum height=112pt, rotate=180] at ([xshift=4pt]mymatr-3-1.east) {\rotatebox{180}{Some 5}};

\node[right=4pt of mymatr-1-3,  
minimum height=30pt] (suprec) {};
\node[above=4pt of mymatr-2-4, mytri, rotate=-90] (suptri) {};
\coordinate (suptrir) at ([xshift=10pt]suptri.right corner);
\coordinate (suptril) at ([xshift=-10pt]suptri.left corner);
\draw[myar]
     (suprec.north west) 
    -| (suptril) -- (suptri.left corner) 
    -- (suptri.apex) -- (suptri.right corner)
    -- (suptrir) |- (suprec.south west) -- cycle;
\node[align=left, anchor=west, font=\footnotesize] at (suprec) {Something\\ something else};
\node[below=4pt of mymatr-2-4, align=left, 
minimum width=30pt] (infrec) {};
\node[right=4pt of mymatr-3-3, mytri,  rotate=180] (inftri) {};
\coordinate (inftrir) at ([yshift=-10pt]inftri.right corner);
\coordinate (inftril) at ([yshift=10pt]inftri.left corner);
\draw[myar]
     (infrec.north east) 
    |- (inftril) -- (inftri.left corner) 
    -- (inftri.apex) -- (inftri.right corner)
    -- (inftrir) -| (infrec.north west) -- cycle;
\node[align=left, anchor=north west, text width=26pt, font=\footnotesize] at (infrec.north west) {Some\-thing written here};
\node[align=left, anchor=west, text width=50pt, font=\footnotesize] at (inftri.lower side) {Some\-thing else written here};
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

3
  • Thanks, this looks promising! Is there a way to have the text inside the other arrows as well (as \node[arrow, ])?
    – Giane
    Aug 8 at 17:29
  • I was thinking of arrows similar to L-shaped arrows (ie thicker and with the text inside the arrow, but no L-shaped). Thanks!
    – Giane
    Aug 8 at 20:28
  • 1
    @Giane See my edit.
    – CarLaTeX
    Aug 9 at 20:47
12

The shapes libraries that TikZ provides don't have such a shape. Of course, it is possible to create it, but I would think the most flexible approach is probably not to use shapes but to use paths and attach nodes to them.

I created a style that you may want to use. It allows you to change the thickness of the arrow, the size of the tip (by defining the length that the tip extends the width of the line) as well as the fill color. Other styles provided by TikZ can be used as well, of course. The text can be placed using nodes on a path. The option rounded corners won't apply to the arrow tip.

\documentclass[border=10pt]{standalone} 
\usepackage{tikz}
\usetikzlibrary{shapes.arrows, arrows.meta}

\tikzset{
    big arrow fill/.code={\definecolor{big arrow fill}{named}{#1}},
    big arrow fill={white},
    big arrow/.style 2 args={
        line width=#1, 
        -{Triangle[length={.5*(#1+#2)},width={#1+#2}]},
        postaction={
            -{Triangle[length={.5*(#1+#2)-sqrt(2)*1pt},width={#1+#2-sqrt(2)*2pt}]},
            draw=big arrow fill,
            line width={#1-1pt},
            shorten >={sqrt(2)*.5pt},
            shorten <=.5pt
        },
        every node/.style={
            text width=#1,
            align=center
        }
    }
}

\begin{document}

\begin{tikzpicture}

    \node[single arrow, draw] at (0,3) { I am a shape };

    \draw[big arrow={15pt}{5pt}, blue] (3,1) -- node[midway] {A} (3,0) -- node[midway] {B} (4,0) -- node[midway] {C} (4,-2);

    \draw[big arrow={15pt}{5pt}] (5,4) arc (180:270:3cm) node[midway] {A};

    \draw[big arrow={3cm}{15pt}, big arrow fill=yellow] (0,1) -- node[midway] {maybe this is a way}  (0,-4) -- node[midway] {to solve this problem ...} (5,-4);

\end{tikzpicture}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.