1

What is the best way to draw this in TIKZ?

enter image description here

I was thinking I could define a custom shape with this "arrow" form, but did not really figure out how to achieve this. Maybe there are better solutions?

2
  • 1
    See here for a question with a similar scope and title.
    – user194703
    May 14, 2020 at 16:15
  • @Schrödinger'scat I too remembered and searched the same, but couldn't able to get the link, thanks...
    – MadyYuvi
    May 15, 2020 at 4:35

2 Answers 2

3

Please try with this:

\documentclass{book}
\usepackage{xcolor}
\usepackage{tikz}%
\usetikzlibrary{shapes.arrows}%
\usetikzlibrary{shapes.symbols}

\def\splarrow#1{%
\begin{tikzpicture}%
[every node/.style={single arrow,draw=none,single arrow head
extend=0pt}]\node[fill=black!50]{\textcolor{white}{#1}};%
\end{tikzpicture}}%

\makeatletter
\tikzset{product size/.style={minimum width=2cm, 
    minimum height=15pt,
    text height=1ex,
  },
  product/.style={ % removed fill and text colour setting
    draw,signal, 
    signal to=east, 
    signal from=west,
    product size,
    draw=white
  },
}
\newcommand{\diagram}[1]{%
 % changed from "\x in" to "\x/\clr in"
 \foreach [count=\xi, count=\prevx from 0] \x/\clr in {#1}{%
  \ifnum\xi=1
    % added fill=\clr,signal from=none
    \node[product,fill=\clr,signal from=none] (x-\xi) {\x};
  \else
    % added fill=\clr
    \node[product,fill=\clr,anchor=west] (x-\xi) at (x-\prevx.east) {\x};
  \fi
 }
}

\newcommand{\arrowtext}[4]{%
\begin{tikzpicture}%
% "text/colour name", instead of just "text"
\diagram{#1/black!50,#2/black!50,#3/black!50,#4/black!50}%
\end{tikzpicture}\ignorespaces%
\@afterheading\@afterindentfalse%
}%
\makeatother

\begin{document}

\arrowtext{Arrow 1}{Arrow 2}{Arrow 3}{Arrow 4}

\end{document}

enter image description here

4

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary {decorations.shapes,shapes.symbols,calc}

\begin{document}
\begin{tikzpicture}
                    [
                    every node/.style={signal, draw, text=white, signal to=nowhere}
                    ]
\node[fill=green!65!black, signal to=east] at (0,1) {To East};
\node[fill=red!65!black, signal from=east] at (0,0) {From East};
\end{tikzpicture}

\end{document}

You must log in to answer this question.

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