如何在 LaTeX 中创建此楼梯过程图?

如何在 LaTeX 中创建此楼梯过程图?

在此处输入图片描述

如何用微软 Smartart 制作楼梯流程图并且在每个楼梯下方放置文本框?

% Double Arrows a la Chef
% Author: Dominik Haumann
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, decorations.markings}

% for double arrows a la chef
% adapt line thickness and line width, if needed
\tikzstyle{vecArrow} = [thick, decoration={markings,mark=at position
   1 with {\arrow[semithick]{open triangle 60}}},
   double distance=1.4pt, shorten >= 5.5pt,
   preaction = {decorate},
   postaction = {draw,line width=1.4pt, white,shorten >= 4.5pt}]
\tikzstyle{innerWhite} = [semithick, white,line width=1.4pt, shorten >= 4.5pt]

\begin{document}

\begin{tikzpicture}[thick]
  \node[draw,rectangle] (a) {A};
  \node[inner sep=0,minimum size=0,right of=a] (k) {}; % invisible node
  \node[draw,rectangle,right of=k] (b) {b};
  \node[draw,rectangle,below of=b] (c) {C};
\node[draw,rectangle,right of=c] (d) {D};
  % 1st pass: draw arrows
  \draw[vecArrow] (a) to (b);
  \draw[vecArrow] (b) to (c);
  \draw[vecArrow] (c) to (d);

  % 2nd pass: copy all from 1st pass, and replace vecArrow with innerWhite
  \draw[innerWhite] (a) to (b);
  \draw[innerWhite] (k) |- (c);

  % Note: If you have no branches, the 2nd pass is not needed
\end{tikzpicture}

\end{document}

我尝试使用方框和箭头来实现,如下面的代码所示。我不知道如何在楼梯下方直接插入文本。

在此处输入图片描述

答案1

一种可能的方法是使用 将粗线添加到节点定义中append after command

\documentclass[tikz,border=3mm]{standalone}
\definecolor{mblue}{RGB}{85,113,192}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[font=\sffamily,pft/.style={align=left,
    alias=tmp,
    append after command={
    ([xshift=-1ex,yshift=0.5ex]\tikzlastnode.north west)
    edge[mblue,line width=0.8ex,line cap=rect]
    ([xshift=-1ex,yshift=-0.5ex]\tikzlastnode.west)
    edge[mblue,line width=0.8ex]
    ([xshift=2ex,yshift=0.5ex]\tikzlastnode.north east) 
    coordinate(aux)
    }},pics/trian/.style={code={\fill (-2ex,-2ex) -- (0,0) |-cycle;}}]%
 \path node[pft] (zero) {step\\ zero}
 foreach \X in {one,two,three}
 {node[right=1.8em of tmp.east,anchor=south west,pft](\X) {step\\ \X}
 ([xshift=-2.2ex,yshift=0.9ex]\X.north west) pic[mblue]{trian}};
\end{tikzpicture}
\end{document}

在此处输入图片描述

或者使用手动定位和三角形的布尔值。

\documentclass[tikz,border=3mm]{standalone}
\definecolor{mblue}{RGB}{85,113,192}
\usetikzlibrary{positioning}
\newif\ifTikZStepBoxTriangle
\begin{document}
\begin{tikzpicture}[font=\sffamily,
    step has triangle/.is if=TikZStepBoxTriangle,
    step has triangle/.default=true,step has triangle=true,
    pft/.style={align=left,
    alias=tmp,
    append after command={
    ([xshift=-1ex,yshift=0.5ex]\tikzlastnode.north west)
    edge[mblue,line width=0.8ex,line cap=rect]
    ([xshift=-1ex,yshift=-0.5ex]\tikzlastnode.west)
    edge[mblue,line width=0.8ex]
    ([xshift=2ex,yshift=0.5ex]\tikzlastnode.north east) 
    \ifTikZStepBoxTriangle
    ([xshift=-2.2ex,yshift=0.9ex]\tikzlastnode.north west) pic[mblue]{trian}
    \fi
    }},pics/trian/.style={code={\fill (-2ex,-2ex) -- (0,0) |-cycle;}}]%
 \path node[pft,step has triangle=false] (zero) {step\\ zero};
 \path node[right=1.8em of zero.east,anchor=south west,pft](one) {step\\ one};
 \path node[right=1.8em of one.east,anchor=south west,pft](two) {step\\ two};
 \path node[right=1.8em of two.east,anchor=south west,pft](three) {step\\ three};
\end{tikzpicture}
\end{document}

相关内容