答案1
请尝试一下这个:
\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}
答案2
\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}