Latex 流程图讲解


在这里插入图片描述

\documentclass[UTF8]{ctexart}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}

\begin{document}
\pagestyle{empty} % 无页眉页脚

\tikzstyle{startstop} = [rectangle,rounded corners, minimum width=3cm,minimum height=1cm,text centered, draw=black,fill=red!30]
\tikzstyle{io} = [trapezium, trapezium left angle = 70,trapezium right angle=110,minimum width=3cm,minimum height=1cm,text centered,draw=black,fill=blue!30]
\tikzstyle{process} = [rectangle,minimum width=3cm,minimum height=1cm,text centered,text width =3cm,draw=black,fill=orange!30]
\tikzstyle{decision} = [diamond,minimum width=3cm,minimum height=1cm,text centered,draw=black,fill=green!30]
\tikzstyle{arrow} = [thick,->,>=stealth]

\begin{tikzpicture}[node distance=2cm]
\node (start) [startstop] {Start};
\node (input1) [io,below of=start] {Input};
\node (process1) [process,below of=input1] {Process 1};
\node (decision1) [decision,below of=process1,yshift=-0.5cm] {Decession 1};
\node (process2a) [process,below of=decision1,yshift=-0.5cm] {Process 2aaaaaa aaaaaaa aaaa};
\node (process2b) [process,right of =decision1,xshift=2cm] {Process 2b};
\node (out1) [io,below of=process2a] {Output};
\node (stop) [startstop,below of=out1] {Stop};

\draw [arrow] (start) -- (input1);
\draw [arrow] (input1) -- (process1);
\draw [arrow] (process1) -- (decision1);
\draw [arrow] (decision1) -- node[anchor=east] {yes} (process2a);
\draw [arrow] (decision1) -- node[anchor=south] {no} (process2b);
\draw [arrow] (process2b) |- (process1);
\draw [arrow] (process2a) -- (out1);
\draw [arrow] (out1) -- (stop);
\end{tikzpicture}

\end{document}

tikzstyle 定义node和箭头的属性

创建节点

name

(decision1):这个节点的name,后面需要用这个name调用这个节点。

属性

decision:需要调用的节点的属性

位置

below of=process1:定义节点的位置
left of:
right of:

偏移,对位置进行微调

yshift:
xshift:

title

{Decession 1}:结果显示的标题

箭头绘制

属性

(decision1):箭头的其实位置
(process2a):箭头的末端位置

线型

–:直线
|-:先竖线后横线
-|:向横线后竖线

文字:如果需要在箭头上添加文字

{yes}:需要添加的文字

文字的位置,上南下北左东右西(与地图方位不一致)

[anchor=east]:
[anchor=south]:
[anchor=west]:
[anchor=north]:
[anchor=center]:

节点node

节点形状

rectangle:矩形,可加圆角(rounded corners)
trapezium:平行四边形
diamond:菱形

尺寸

minimum width
minimum height

文本

text centered:文本居中

文本宽度

text width=3cm:文本超过3cm时会自动换行

边框

draw

填充颜色

fill

箭头

线粗:

thick:粗
thin:细

箭头

->:反向箭头
<-:正向箭头
<->:双向箭头

虚线

dashed

箭头形状

>=stealth
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值