\begin{document}
\pagestyle{empty}
% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=white!20,
text width=5.5em, text badly centered, node distance=5cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=white!20,
text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=5cm,
minimum height=5em]
\begin{tikzpicture}[node distance = 4cm, auto]
% Place nodes
\node [block] (sume) {1.-Sume variables de holgura (forma estándar)};
\node [block, below of=sume] (calcu) {2.-Calcule una primer solución básica factible};
\node [decision, below of=calcu] (decide) {3.-¿Existe una solución básica factible adyacente que sea mejor?};
\node [block, right of=decide, node distance=5cm] (no) {5.-Entonces la solucion basica factible actual es óptima};
\node [block, left of=decide, node distance=5cm] (yes) {4.-Entonces calcule el valor de la funcion $Z$ para la nueva solucion básica factible};
% Draw edges
\path [line] (sume) -- (calcu);
\path [line] (calcu) -- (decide);
\path [line] (decide) -- node {Si} (yes);
\path [line] (yes) -| (calcu);
\path [line] (decide) -- node {No} (no);
\end{tikzpicture}
\end{document}
这是我第一次在 Latex 中创建流程图,到目前为止,结果看起来很糟糕。有人能帮我让它看起来与我拥有的图像相似吗?
- 这是我所做的结果,问题是从 4 到 2 的箭头是翻转的,我该如何解决这个问题
- 什么指令会使箭头看起来更粗?
答案1
这就是您所寻求的吗?
问题是从 4 到 2 的箭头是翻转的,我该如何解决这个问题
\path [line] (yes.west) --+(-1cm,0) |- (h); %
从(yes.west)
左边 1cm 处绘制,然后垂直向上和水平移动到(h)
代码用来node
定义的位置(h)
什么指令可以让箭头看起来更粗?修改
line
tizstyle 中定义的样式以添加thick
、 或very thick
或line width=xx pt
如果你对如何让箭头看起来更粗有疑问,那么请检查是否可以更改 TikZ/PGF 中箭头的大小?
得到下面的图像
代码
\documentclass[tikz,border=1cm]{standalone}
\usetikzlibrary{matrix, shapes, arrows,calc, positioning}
\begin{document}
\pagestyle{empty}
% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=white!20,
text width=3cm, text badly centered, node distance=5cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=white!20,
text width=3cm, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm,
minimum height=5em]
\begin{tikzpicture}[node distance = 4cm, auto]
% Place nodes
\node [block] (sume) {1.-Sume variables de holgura (forma estándar)};
\node [block, below of=sume] (calcu) {2.-Calcule una primer solución básica factible};
\node [decision, below of=calcu] (decide) {3.-¿Existe una solución básica factible adyacente que sea mejor?};
\node [block, below right =1cm and 1 cm of decide, node distance=5cm] (no) {5.-Entonces la solucion basica factible actual es óptima};
\node [block, below left = 1cm and 1cm of decide, node distance=5cm] (yes) {4.-Entonces calcule el valor de la funcion $Z$ para la nueva solucion básica factible};
% Draw edges
\path [line] (sume) -- (calcu);
\path [line] (calcu) --node[pos=0.5](h){} (decide);
\path [line] (decide) -| node[pos=0.2,above] {Si} (yes);
\path [line] (yes.west) --+(-1cm,0) |- (h);
\path [line] (decide) -| node[pos=0.2,above] {No} (no);
\end{tikzpicture}
\end{document}