我尝试在论文中放入两个流程图。我尝试使用 tikz。每个流程图都可以单独使用。但是当我尝试将它们都放在两个图中时,我遇到了这个错误:
<argument> ...f@ya \pgf@y =\pgfshapeaspectinverse
\pgf@xa \advance \pgf@y by...
第一个流程图是:
\usetikzlibrary{shapes,arrows,shadows}
\tikzstyle{decision}=[draw,diamond]
\tikzstyle{line}=[draw,-latex']
\tikzstyle{elli}=[draw,ellipse]
\tikzstyle{block}=[draw,rectangle]
\scriptsize
\begin{tikzpicture}
\node [elli, align=center] (dc) {Run DCOPF};
\node [decision, below of=dc, align=center, text width=4em,node distance=7em] (checkCong) {Is there any\\ congested\\ line?};
\node [block, below of=checkCong, align=center,node distance=6.5em] (Init) {$\nu=0$\\$\theta^0=\theta^{DCOPF}$};
\node [block, below of=Init, align=center,node distance=4em] (masterIni) {Run master problem\\ without considering benders cut\\ to initialize $\lambda,\,p_g,\,u$};
\node [block, below of=masterIni, align=center,node distance=4em] (IncNu) {$\nu=\nu+1$};
\node [block, below of=IncNu,node distance=4em] (sub) {Solve subproblem};
\node [decision, below of=sub,node distance=5em, align=center] (phiCheck) {Is\\ $\phi>0$?};
\node [block, below of=phiCheck, align=center,node distance=7em] (benders) {Generate infeasibilty cuts\\ and forward it\\ to master problem};
\node [block, below of=benders,node distance=4em] (master) {Solve master problem};
\node [block, below of=master,node distance=3em] (update) {Update $\lambda^{\nu},\,p_g^{\nu},\,u^{\nu},\,\theta^{\nu}$};
\node [decision, below of=update, align=center,node distance=6em, minimum height=5mm] (convCheck) {Convergence \\ check};
\node [elli, below of=convCheck,node distance=7em] (end){end};
\node [decision, left of=end,xshift=-10em,yshift=20em,align=center] (maxIter) {Is\\ $\nu>\nu^{max}$?};
%arrows
\path [line] (dc)--(checkCong);
\path [line] (checkCong)--(Init);
\path [line] (Init)--(masterIni);
\path [line] (masterIni)--(IncNu);
\path [line] (IncNu)--(sub);
\path [line] (sub)--(phiCheck);
\path [line] (phiCheck) -- node [near start, xshift=1em] {Yes} (benders);
\path [line] (benders)--(master);
\path [line] (master)--(update);
\path [line] (update)--(convCheck);
\path [line] (convCheck)--node [near start, xshift=1em] {Yes} (end);
\path [line] (convCheck)-|node [near start, yshift=0.5em] {No}(maxIter);
\path [line] (maxIter)|-(IncNu);
\path [line] (phiCheck)--++ (3,0) node [near start, yshift=0.5em] {No} |- (convCheck);
\end{tikzpicture}
and the second one is:
\begin{tikzpicture}
\usetikzlibrary{shapes,arrows,shadows}
\tikzstyle{decision}=[diamond,draw]
\tikzstyle{line}=[draw,-latex']
\tikzstyle{elli}=[draw,ellipse]
\tikzstyle{block}=[draw,rectangle]
\scriptsize
\node [block, align=center] (masterm) {Solve master problem} ;
\node [block, below of=masterm, align=center, node distance=3em] (subm) {Solve sub problem};
\node [decision, below of=subm, align=center, node distance=6em] (check) {Is there\\ infeasibility?};
\node [elli, below of=check, align=center, node distance=6em] (end) {End};
\node [block, left of=end, xshift=-8em, yshift=10em, align=center] (cut) {Generate infeasibility cut};
%arrows
\path [line] (masterm)--(subm);
\path [line] (subm)--(check);
\path [line] (check)-- node [near start, xshift=1em] {No} (end);
\path [line] (check) -| node [near start, yshift=0.5em] {Yes} (cut);
\path [line] (cut) |- (masterm);
\end{tikzpicture}
答案1
您可以:
上次运行后遗留了辅助文件,在这种情况下,我会尝试删除临时文件并重新编译。
或者您的库不是最新的,在这种情况下我建议更新到 TeXLive2014。
添加\documentclass{article
along with\usepackage{tikz}
可以使您的代码编译得很好(以及一些缩放以使内容适合):
代码:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,shadows}
\tikzstyle{decision}=[draw,diamond]
\tikzstyle{line}=[draw,-latex']
\tikzstyle{elli}=[draw,ellipse]
\tikzstyle{block}=[draw,rectangle]
\begin{document}
\scriptsize\noindent
\begin{tikzpicture}[scale=0.6]
\node [elli, align=center] (dc) {Run DCOPF};
\node [decision, below of=dc, align=center, text width=4em,node distance=7em] (checkCong) {Is there any\\ congested\\ line?};
\node [block, below of=checkCong, align=center,node distance=6.5em] (Init) {$\nu=0$\\$\theta^0=\theta^{DCOPF}$};
\node [block, below of=Init, align=center,node distance=4em] (masterIni) {Run master problem\\ without considering benders cut\\ to initialize $\lambda,\,p_g,\,u$};
\node [block, below of=masterIni, align=center,node distance=4em] (IncNu) {$\nu=\nu+1$};
\node [block, below of=IncNu,node distance=4em] (sub) {Solve subproblem};
\node [decision, below of=sub,node distance=5em, align=center] (phiCheck) {Is\\ $\phi>0$?};
\node [block, below of=phiCheck, align=center,node distance=7em] (benders) {Generate infeasibilty cuts\\ and forward it\\ to master problem};
\node [block, below of=benders,node distance=4em] (master) {Solve master problem};
\node [block, below of=master,node distance=3em] (update) {Update $\lambda^{\nu},\,p_g^{\nu},\,u^{\nu},\,\theta^{\nu}$};
\node [decision, below of=update, align=center,node distance=6em, minimum height=5mm] (convCheck) {Convergence \\ check};
\node [elli, below of=convCheck,node distance=7em] (end){end};
\node [decision, left of=end,xshift=-10em,yshift=20em,align=center] (maxIter) {Is\\ $\nu>\nu^{max}$?};
%arrows
\path [line] (dc)--(checkCong);
\path [line] (checkCong)--(Init);
\path [line] (Init)--(masterIni);
\path [line] (masterIni)--(IncNu);
\path [line] (IncNu)--(sub);
\path [line] (sub)--(phiCheck);
\path [line] (phiCheck) -- node [near start, xshift=1em] {Yes} (benders);
\path [line] (benders)--(master);
\path [line] (master)--(update);
\path [line] (update)--(convCheck);
\path [line] (convCheck)--node [near start, xshift=1em] {Yes} (end);
\path [line] (convCheck)-|node [near start, yshift=0.5em] {No}(maxIter);
\path [line] (maxIter)|-(IncNu);
\path [line] (phiCheck)--++ (3,0) node [near start, yshift=0.5em] {No} |- (convCheck);
\end{tikzpicture}
%
\begin{tikzpicture}
\usetikzlibrary{shapes,arrows,shadows}
\tikzstyle{decision}=[diamond,draw]
\tikzstyle{line}=[draw,-latex']
\tikzstyle{elli}=[draw,ellipse]
\tikzstyle{block}=[draw,rectangle]
\scriptsize
\node [block, align=center] (masterm) {Solve master problem} ;
\node [block, below of=masterm, align=center, node distance=3em] (subm) {Solve sub problem};
\node [decision, below of=subm, align=center, node distance=6em] (check) {Is there\\ infeasibility?};
\node [elli, below of=check, align=center, node distance=6em] (end) {End};
\node [block, left of=end, xshift=-8em, yshift=10em, align=center] (cut) {Generate infeasibility cut};
%arrows
\path [line] (masterm)--(subm);
\path [line] (subm)--(check);
\path [line] (check)-- node [near start, xshift=1em] {No} (end);
\path [line] (check) -| node [near start, yshift=0.5em] {Yes} (cut);
\path [line] (cut) |- (masterm);
\end{tikzpicture}
\end{document}