Tikz:流程图
% 此文件是liuchengtu.tex 因?yàn)樵赥ikzEdt中可以實(shí)時(shí)看到結(jié)果。但不支持中文,
% 所以分兩文件寫(xiě),主文件用來(lái)編輯中文。
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri}
\begin{tikzpicture}[
%定義格式
%箭頭的模式是latex 默認(rèn)模式
>=latex,
%兩個(gè)結(jié)點(diǎn)距離
node distance=5mm,
% hv path 表示一個(gè)結(jié)點(diǎn)到另一個(gè)結(jié)點(diǎn)是先水平再垂直。vh 相反。skip loop 表示
%垂直-水平-垂直 vskip loop 表示水平-垂直-水平
hv path/.style={to path={-| (\tikztotarget)}},
vh path/.style={to path={|- (\tikztotarget)}},
skip loop/.style={to path={-- ++(0,#1) -| (\tikztotarget)}},
vskip loop/.style={to path={-- ++(#1,0) |- (\tikztotarget)}},
%開(kāi)始結(jié)束框模式
startend/.style={
draw,
rectangle,
rounded corners=2mm,
minimum size = 6mm,
thick
},
%輸入輸出模式
ioput/.style = {
draw,
trapezium,
trapezium left angle=60, trapezium right angle=120,
inner sep = 5pt
},
%處理框模式chuli/.style={draw,
rectangle,
minimum size=6mm,
thick,
font=\itshape
},
%判斷模式panduan/.style={draw,
diamond,
minimum size=6mm,
shape aspect=3,
inner sep = 0.1pt,
thick,
font=\itshape
}
]
%----------------------------------模板----------------------------------------
%設(shè)置點(diǎn)及位置
%
%\node (a) [startend] {start};
%\node (b) [ioput,below = of a] {input integer l,m,n};
%\node (c) [panduan,below = of b,font=\small] {$l^2+m^2+n^2=0$};
%\node (d) [chuli,below = of c,yshift = 5pt,font=\small] {$y=70l+21m+15n$};
%\node (e) [panduan,below = of d,yshift=-10mm,font=\small] {$y>105$};
%\node (f) [ioput,below = of e] {output y};
%\node (g) [startend,below = of f] {end};
%
%\node (h) [chuli,below left = of d] {$y=105$};
%\node (i) [chuli,below right = of d,yshift=-5pt] {$y=y-105$};
%%畫(huà)線
%\path (a) edge[->] (b)
% (b) edge[->] (c)
% (c) edge[->] (d)
% (d) edge[->] (e)
% (e) edge[->] (f)
% (f) edge[->] (g);
%
%\path (h) edge [<-,vh path] (c);
%\path (h) edge [->,vh path] ($(e.south)!0.5!(f.north)$);
%\path (i) edge [->,vh path] ($(d.south)+(0,-2mm)$);
%\path (i) edge [<-,vh path] (e);
%
%%寫(xiě)標(biāo)簽
%\node at (-2.1,-2.3) {是};
%\node at (0.45,-6.5) {否};
%-------------------------------------------------模板-------------------------------------------
\node (a) [startend] {開(kāi)始};
\node (b) [chuli,below = of a] {$M=0,N=0,i=1$};
\node (c) [chuli,below = of b] {產(chǎn)生$0\sim1$之間的兩個(gè)隨機(jī)數(shù)分別賦給$x_i,y_i$};
\node (d) [panduan,below = of c ] {$x^2+y^2 \leq 1$};
\node (e) [chuli,below = of d] {$M=M+1$};
\node (f) [chuli,below = of e] {$i=i+1$};
\node (g) [panduan,below = of f ] {$i>1000$};
\node (h) [chuli,below = of g,minimum width = 2cm] {};
\node (i) [ioput,below = of h ]{輸出P};
\node (j) [ioput,below = of i ]{結(jié)束};
\node (k)[chuli,right = of e] {$N = N+1$};
\path (a) edge[->] (b)(b) edge[->] (c)(c) edge[->] (d)(d) edge[->] (e)(e) edge[->] (f)(f) edge[->] (g)(g) edge[->] (h)(h) edge[->] (i)(i) edge[->] (j);
\path (g.west) edge [->,vskip loop=-3cm] ($(b.south)!.5!(c.north)$);
\path (d) edge [->,hv path] (k);
\path (k) edge [->,vh path] ($(e)!.5!(f)$);\node at (2,-3.35) {否};\node at (0.35,-4.3) {是};
\node at (-1.55,-6.9) {否};
\end{tikzpicture} \documentclass{ctexart}
\usepackage{tikz}
\usepackage[top=1in,bottom=1in,right=1in,left=1in]{geometry}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%
\usetikzlibrary{shapes,arrows,intersections,patterns}
\usetikzlibrary{calc}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri}\begin{document}
\input{liuchengtu}
\end{document}
?
轉(zhuǎn)載于:https://www.cnblogs.com/wangl393/p/3416859.html
總結(jié)
- 上一篇: QLive EULA
- 下一篇: 第一次来到博客园.....