我正在使用 TikZ 创建流程图。我需要一个花括号,其中心连接到l1
节点,从 开始bl1.north west
到m3.south west
。
这是我的代码,说明了问题:
\documentclass[a4paper]{article}
\usepackage[top=1cm,bottom=1cm,left=1cm,landscape]{geometry}
\usepackage{tikz}
\usetikzlibrary{positioning,decorations.pathreplacing}
\usetikzlibrary{calc}
\begin{document}
\centering
\pagestyle{empty}
\tikzstyle{startsetup} = [rectangle, draw, text width=10cm, text centered, rounded corners, minimum height=1em, fill=blue!20]
\tikzstyle{block} = [rectangle, draw, text width = 3.5cm, text centered, minimum height = 3em, fill= red!20]
\tikzstyle{lblock} = [rectangle, draw, text width=5cm, text centered, rounded corners, minimum height=1em, fill=yellow!20]
\tikzstyle{DCS} = [rectangle, draw, text width=5cm, text centered, rounded corners, minimum height=1em, fill=orange!50]
\tikzstyle{server} = [rectangle, draw, text width=3.5cm, text centered, minimum height=1em, fill=green!20]
\begin{tikzpicture}[ align=center,decoration={brace}] %node distance=2cm and 4cm,
\node (m1) [startsetup] {Preagreement and Travel Preperation};
\node (m2) [startsetup, below of= m1,node distance=1.5cm] {Site Visit \& Technical Assessment};
\node (bl1) [block, below left =2cm and -2cm of m2 ] {Software exist on CPU and could be uploaded}; %2cm and 0.5cm of
\node (br1) [block, below right=2cm and -2cm of m2 ] {Software is not exist};
\node (br2) [block, below of= br1, node distance=2cm ] {HAZOP, SRS,FSMR to be revised};
\node (br3) [server, below of= br2, node distance=2cm ] {HIMA server and licence preparation};
\node (br4) [block, below of= br3, node distance=2cm ] {Design,Implement logic functions and software assessment};
\node (br5) [DCS, below of= br4, node distance=3cm ] {Pre-commissioning and I/O check \\ \&\\ DCS communication link};
\node (br5) [DCS, below of= br4, node distance=3cm ] {Pre-commissioning and I/O check \\ \&\\ DCS communication link};
\node (m3) [startsetup, below left=3cm and -3cm of br5 ] {Complete SAT procedure \\ \& \\Start UP};
\node (bl2) [block, below of= bl1, node distance= 2cm ] {Logic Function logics asseessment on local licenced machine};
\node (bl3) [server, below of= bl2, node distance= 2cm ] {HIMA server and licence preparation};
\node (bl4) [DCS, below of= bl3, node distance=3cm ] {Pre-commissioning and I/O check \\ \&\\ DCS communication link};
\node (l1) [lblock,left of=bl3,node distance=8cm] { text};
%Flows
\draw [thick, ->] (m1) -- (m2);
\draw [thick, ->] (m2.south) -- ++(0,-1cm) -|node [above] {path(1)}(bl1);
\draw [thick, ->] (m2.south) -- ++(0,-1cm) -|node [above] {path(2)}(br1);
\draw [thick, ->] (bl1) -- (bl2);
\draw [thick, ->] (bl2) -- (bl3);
\draw [thick, ->] (bl3) -- (bl4);
\draw [thick, ->] (br1) -- (br2);
\draw [thick, ->] (br3) -- (br4);
\draw [thick, ->] (br4) -- (br5);
\draw [very thick, orange, ->] (bl4.south) --++(0,-2.5cm) -| (m3);
\draw [very thick, orange, ->] (br5.south) --++(0,-0.668cm) -| (m3);
%\draw [thick,orange, ->] (bl4.south) -- ++(0,-2cm) -- ++(2cm,0)-- ++(0,-2.82cm);%(bl4.south) --++(0,-1cm)-|(m3.north west)
%\draw [thick, orange,->] (br5.south) --++(0,-1cm) --++(-1cm,0) --++(0,-2cm); %\draw [thick, orange,->] (br5.south) --++(0,-1cm) -|(m3);
%\draw[decorate,decoration={brace,amplitude=3mm}](bl1)--node[right,anchor=south west] {$\log_{3/2}n$}(m3);
\draw [decorate,decoration={brace,amplitude=20pt,mirror},xshift=4pt,yshift=0pt]
(bl1.north west) -- (m3.south west) node [black,midway,xshift=-3cm]
{};
%\node at (l1) {};
\end{tikzpicture}
\end{document}
答案1
尝试
\draw [decorate,decoration={brace,amplitude=20pt,mirror},xshift=4pt,yshift=0pt]
(bl1.north -| bl4.west) -- (m3.south -| bl4.west) node [black,midway,xshift=-3cm]
{};
如果它能满足你的要求:
我玩你的姆韦一点点...看看获得的代码是否对你有趣:
\documentclass[a4paper]{article}
\usepackage[%showframe,
margin=1.5cm,
landscape]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
calc, chains,
decorations.pathreplacing,
positioning}
\makeatletter
\tikzset{FlowChart/.style = {
supress join/.code = {\def\tikz@after@path{}},
start/.style args = {##1/##2}{rectangle, rounded corners, draw,
text width=##1, minimum height=8mm,
fill=##2,
align=flush center, inner sep=2mm, outer sep=0mm,
on chain, join=by LA},
start/.default = 80mm/blue!30,
%
block/.style args = {##1/##2}{rectangle, draw,
text width=##1, minimum height=16mm,
fill=##2,
align=flush center, inner sep=2mm, outer sep=0mm,
on chain, join=by LA},
block/.default=34mm/red!30,
%
B/.style = {decorate,
decoration={brace,amplitude=4mm, raise=2mm,
##1} },
B/.default = mirror,
LA/.style = {-Triangle,thick}
}% end of FlowChart style
}% end of tikzset
\makeatother
\begin{document}
\pagestyle{empty}
\begin{center}
\begin{tikzpicture}[FlowChart,
node distance = 8mm and 12mm,
start chain = going below
]
\node (m1) [start] {Preagreement and Travel Preperation};
\node (m2) [start] {Site Visit \& Technical Assessment};
% left branch
\node (bl1) [block, supress join,
below left=of m2.south]
{Software exist on CPU and could be uploaded};
\node (bl2) [block] {Logic Function logics asseessment on local licenced machine};
\node (bl3) [block=32mm/green!30]
{HIMA server and licence preparation};
\node (bl4) [start=42mm/orange!30]
{Pre-commissioning and I/O check \\ \&\\ DCS communication link};
% right branch
\node (br1) [block, supress join,
below right=of m2.south]
{Software is not exist};
\node (br2) [block] {HAZOP, SRS,FSMR to be revised};
%
\node (br3) [block=32mm/green!30]
{HIMA server and licence preparation};
\node (br4) [block,] {Design,Implement logic functions and software assessment};
\node (br5) [start=42mm/orange!30]
{Pre-commissioning and I/O check \\
\&\\
DCS communication link};
% midle branch again
\node (m3) [start, supress join,
below=of m2 |- br5.south]
{Complete SAT procedure \\
\& \\
Start UP};
%Flows
\draw [thick] (m2.south) -- ++(0,-3mm) coordinate (aux1);
\draw[LA] (aux1) -| (bl1);
\draw[LA] (aux1) -| (br1);
\draw [very thick, orange]
(br5.south) -- ++ (0,-3mm) -| coordinate[pos=0.25] (aux2) (bl4);
\draw [LA, very thick, orange]
(aux2) -- (m3);
\draw [B] (bl1.north -| bl4.west) --
node (l1) [block=32mm/yellow!30, supress join,
left=1cm] {some text?}
(m3.south -| bl4.west);
\end{tikzpicture}
\end{center}
\end{document}
补充:
关于您在下面评论中提出的其他问题,由于缺乏信息,我只能给您提供有关文档结构的一般建议:
\documentclass[....]{....}
% used packages
%tikzsets (i) for FlowChart, (ii) for ...
\begin{document}
%document body
\begin{figure}
\input{flowchart-1}% name of file in which you store flowchart code
\caption{May important flowchart :-)}
\label{fig:flowchart-1}
\end{figure}
% other text
\end{document}
文件flowchart-1
(假设,这是图像的文件名)必须以 开头\begin{tikzpicture}
并以 结尾tikzpicture
。
除了这种粗鲁的方法之外,您还应该考虑在工作流程中使用该standalone
包。但是这(作为整个附录)超出了您的问题范围。如果您对此有疑问,请提出新问题,以便更多人看到它并能够帮助您。