答案1
请尝试:
\documentclass{book}
\usepackage{xcolor}
\usepackage{tikz}%
\usetikzlibrary{shapes.arrows}%
\usetikzlibrary{shapes.symbols}
\begin{document}
\newcommand{\arrowtextfont}{\color{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
}
}
\definecolor{firstarrowcolor}{cmyk}{0.55,0.03,0.13,0}%
\definecolor{secondarrowcolor}{cmyk}{0.70,0.04,0.16,0}%
\definecolor{thirdarrowcolor}{cmyk}{0.85,0.04,0.20,0}%
\definecolor{fourtharrowcolor}{cmyk}{1,0.05,0.23,0}%
\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
},
}
\begin{tikzpicture}%
\diagram{\arrowtextfont Test/firstarrowcolor,\arrowtextfont Second
text/secondarrowcolor,\arrowtextfont Third
text/thirdarrowcolor,\arrowtextfont Fourth text/fourtharrowcolor}%
\end{tikzpicture}
\end{document}
输出
答案2
基于Asmartdiagram
的版本:
\documentclass[tikz,border=2pt]{standalone}
\usepackage{smartdiagram}
\begin{document}
\smartdiagramset{uniform sequence color=true,
sequence item uniform color=cyan!20,
sequence item border color=white,
}
\smartdiagram[sequence diagram]{Brainstorm,Determine Problem,Compose Hypothesis}
\end{document}
结果:
并且为了设置第一项,对样式进行必要的修改signal from=nowhere
:
\documentclass[tikz,border=2pt]{standalone}
\usepackage{smartdiagram}
\tikzset{sequence item/.append style={
/utils/exec={\ifnum\xi=1% modifying the style of only one node - from https://tex.stackexchange.com/q/502947
\tikzset{signal from=nowhere}
\fi
}
}
}
\begin{document}
\smartdiagramset{uniform sequence color=true,
sequence item uniform color=cyan!20,
sequence item border color=white,
}
\smartdiagram[sequence diagram]{Brainstorm,Determine Problem,Compose Hypothesis}
\end{document}
结果:
答案3
您可以使用signal
节点形状并将节点放在链上。
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{chains,shapes.symbols}
\definecolor{myc}{RGB}{224,237,243}
\begin{document}
\begin{tikzpicture}[nodes={shape=signal,signal from=west, signal to=east,
align=center,fill=myc,font=\sffamily,on chain,minimum height=3.5em,
inner xsep=1em},start chain=going right,node distance=1ex]
\path node[signal from=nowhere]{Brainstorm} node{Determine\\ Problem}
node{Compose\\ Hypothesis};
\end{tikzpicture}
\end{document}