![错误作为失控参数?](https://linux22.com/image/416555/%E9%94%99%E8%AF%AF%E4%BD%9C%E4%B8%BA%E5%A4%B1%E6%8E%A7%E5%8F%82%E6%95%B0%EF%BC%9F.png)
我正在编写流程图的代码。当我运行代码时,我得到了失控参数错误。代码如下:
\documentclass[border=50pt]{standalone}
\usepackage{utf8}{inputence}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\tikzstyle{startstop}=[rectangle, rounded corners, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=red!30]
\tikzstyle{process}=[rectangle, rounded corners, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!30]
\tikzstyle{decision}=[rectangle, rounded corners, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!30]
\tikzstyle{arrow}={thick,->,>=stealth}
\begin{document}
\begin{tikzpicture}[node distance=0.6cm]
\node (start) [startstop] {Initilization of model};
\node (pro1) [process, below of=start] {Calculate time of next sample iteration};
\node (pro2) [process, below of=pro1] {Calculate outputs};
\node (pro3) [process, below of=pro2] {Update discreat states};
\node (pro4) [process, below of=pro3] {Update discreat states};
\end{tikzpicture}
有人能帮我吗。
答案1
改变
\usepackage{utf8}{inputence}
到
\usepackage[utf8]{inputenc}
然后改变
\tikzstyle{arrow}={thick,->,>=stealth}
到
\tikzstyle{arrow}=[thick,->,>=stealth]
(请注意,\tikzset{arrow/.style={thick,->,>=stealth}}
更推荐这样做。)\end{document}
最后附加上去,这样示例就可以编译了。
为了使输出看起来更好,您还可以更改以下行
\node (pro2) [process, below of=pro1] {Calculate outputs};
到
\node (pro2) [process, below=of pro1] {Calculate outputs};
在 tikz 库的帮助下positioning
。
应用了所有更改的完整示例:
\documentclass[border=50pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows, positioning}
\tikzset{
common/.style={
rectangle, rounded corners, minimum width=3cm, minimum height=1cm, text centered, draw=black
},
startstop/.style={
common, fill=red!30
},
process/.style={
common, fill=blue!30
},
decision/.style={
common, fill=blue!30
},
arrow/.style={
thick,->,>=stealth
}
}
\begin{document}
\begin{tikzpicture}[node distance=0.6cm]
\node (start) [startstop] {Initilization of model};
\node (pro1) [process, below=of start] {Calculate time of next sample iteration};
\node (pro2) [process, below=of pro1] {Calculate outputs};
\node (pro3) [process, below=of pro2] {Update discreat states};
\node (pro4) [process, below=of pro3] {Update discreat states};
\end{tikzpicture}
\end{document}
顺便说一句:你可以在PGF 手册,第 5 节。