我正在尝试用 LaTeX 制作流程图,但画得不好看!以下是我目前的情况:
%styles
\tikzstyle{terminal1} = [terminal, draw, fill=red!40]
\tikzstyle{line}=[draw,-latex', thick]
\tikzstyle{decision1}=[draw, decision, fill = red!50]
\tikzstyle{process1}=[draw, process, fill=blue!30, text width=10 em, text centered, minimum height = 15 mm, node distance = 20mm]
\tikzstyle{predproc1}=[draw, predproc, fill=blue!30, text width=10 em, text centered, minimum height = 15 mm, node distance = 20mm]
\usepackage{flowchart}
\usepackage{tikz}
\usetikzlibrary{matrix,shapes,arrows,positioning,chains, shadows}
\begin{tikzpicture}
\node[process1](order){Order};
\node[predproc1, right of = order, yshift=30mm, xshift=60mm](generate_code){Generate Machining Code};
\node[predproc1, right of = order, yshift=-30mm, xshift=60mm](determine_tooling){Determine Tooling};
\node[process1, right of = order, xshift=100mm](machining_setup){Machining Setup};
\coordinate (point1) at (3.5cm,0);
\coordinate (point2) at (3.5cm,1cm);
\coordinate (point3) at (3.5cm,-3cm);
%arrows
%\path[line](user) --(start);
\draw[->](order) --(point1)--(point2) -| (generate_code.west);
\draw[->](order) --(point1)--(point3)-|(determine_tooling.west);
\draw[->](determine_tooling) -|(machining_setup);
\draw[->](generate_code) -|(machining_setup);
%\draw[->](process1)-| node [xshift=30mm,yshift=2mm]{yes}(user);
\end{tikzpicture}
有没有简单的方法可以告诉 LaTeX 找到矩形的中间并附加箭头?
我该如何解决箭头方向的问题?
如何增加箭头的粗细?当我使用时
path[line]
,其中一条线消失了!请检查一下。
非常感谢。如果可能的话,请将您的答案保持在靠近我的代码的位置。我知道制作流程图的方法有很多;我对 LaTeX 还很陌生,正在寻找一种简单的方法。
答案1
我猜你喜欢画这样的东西:
在你的姆韦我做了以下更改:
- 删除所有未使用的库
- 为了定位,我使用库的语法
positioning
(above right=of ...
-->above right=of ...
,因此node distances
现在是在节点顺序之间而不是节点中心之间确定的) node distance
由中心决定(针对所有节点)- 我引入了更短(但无意义)的节点名称
- 水平和垂直箭头始终从节点的中间开始和结束(简化解释)
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows, positioning}
\usepackage{flowchart}
\begin{document}
\begin{tikzpicture}[
node distance = 2mm and 4mm,
process1/.style = {draw, process, fill=blue!30,
minimum height = 15mm, text width=8 em, align=flush center},
preprocess/.style = {draw, predproc, fill=blue!30,
minimum height = 15mm, text width=8 em, align=flush center},
line/.style = {-latex', thick}
]
% noides
\node[process1] (n1) {Order};
\coordinate[right=of n1.east] (n2);
\node[preprocess, above right=of n2 |- n1.north] (n3) {Generate Machining Code};
\node[preprocess, below right=of n2 |- n1.south] (n4) {Determine Tooling};
\node[process1, below right=of n3] (n5) {Machining Setup};
% arrows
\draw[line] (n1) -- (n2) |- (n3);
\draw[line] (n2) |- (n4);
%
\draw[line] (n3) -| (n5);
\draw[line] (n4) -| (n5);
\end{tikzpicture}
\end{document}