我的文档中有两个流程图,代码如下。问题是我可以单独编译流程图,但当我为第二个流程图重复代码时,它不再编译。我在 LyX 中收到错误。
! Undefined control sequence.
<argument> ...a \advance \pgf@x by\pgfshapeaspect
\pgf@ya \pgf@y =\pgfshapea...
l.84 ...\textsubscript{\textit{it},max,inner}\\*};
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
% Preview source code
%% LyX 2.1.4 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[american,fontsize=11pt,paper=a4,twoside,openright,titlepage,numbers=noenddot,headinclude,BCOR=5mm,footinclude=true,cleardoublepage=empty]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\usepackage{float}
\usepackage[numbers]{natbib}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
% Classic Thesis Style loader
\makeatother
\input{classicthesis-config.tex}
\makeatletter
% use Latin Modern instead of Computer Modern sans serif
\renewcommand{\sfdefault}{lmss}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{tikz}
\usepackage{pgf}
\usepackage{setspace}
\usepackage{lipsum}
\makeatother
\usepackage{babel}
\begin{document}
\begin{center}
\begin{figure}[H]
\usetikzlibrary{automata,positioning,shapes.geometric, arrows}
\tikzstyle{io} = [rectangle, rounded corners, minimum width= 3cm, minimum height=1cm,text width=5cm, text centered, draw=black, fill=green!40]
\tikzstyle{process} = [rectangle, minimum width= 3cm, minimum height=1cm, text width=5cm, text centered, draw=black, fill=blue!40]
\tikzstyle{NewProcess} = [rectangle, minimum width= 3cm, minimum height=1cm, text width=5cm, text centered, draw=black, fill=blue!60]
\tikzstyle{decision} = [diamond, minimum width=2cm,minimum height=1cm,text height=.25cm,text width=2.5cm, text centered, draw=black, fill=red!40]
\tikzstyle{arrow} = [->,>=stealth]
\begin{tikzpicture}[node distance=4cm]
\node (Initials) [io] {\footnotesize \setstretch{0.75} Initialization and\\*set iteration values\\*x\textsuperscript{0}, \textit{k} = 0\\*};
\node (prc1) [process, below of=Initials,node distance=1.5cm] {\footnotesize \setstretch{0.75} Calculate structural-mechanical responses via FEM\\* \setstretch{0.5} \textsuperscript{\textit{t}}\textbf{\textit{M}}\textsuperscript{\textit{t}}\textbf{\textit{ü}} + \textsuperscript{\textit{t}}\textbf{$f$}\textsuperscript{int} = \textsuperscript{\textit{t}}\textbf{$f$}\textsuperscript{ext}\setstretch{0.5}\\*};
\node (prc2) [process, below of=prc1,node distance=1.55cm] {\footnotesize Calculate target mass\\*\textit{m}\textsuperscript{$\star$,\textit{k}} = \textit{m}\textsuperscript{\textit{k}} + $\Delta$\textit{m}\textsuperscript{\text{k}}\setstretch{0.75}\\*where $\Delta$\textit{m} = \text{$f$\textsubscript{1}}(g)\\*};
\node (prc3) [process, below of=prc2,node distance=1.5cm] {\footnotesize \setstretch{0.75} Calculate state setpoint based on responses\\*\setstretch{0.5}\textit{S\textsuperscript{$\star$}} = $f$\textsubscript{2}(\textit{S\textsuperscript{\textit{k}}})\\*};
\node (prc9) [NewProcess, below of=prc3, node distance=1.55cm,minimum height=1.3cm]{\footnotesize Update Shape variables};
\node (prc4) [process, below of=prc9,node distance=1.6cm] {\footnotesize \setstretch{0.75} Loop over cells: update size variables by adding \\* $\Delta$x=$f$\textsubscript{3}(x\textsuperscript{\textit{k}},\textit{S}\textsubscript{\textsubscript{cell}}\textsuperscript{\textsuperscript{\textit{k},(\textit{k}-1,\textit{k}-2)}},\textit{S}\textsubscript{\textsubscript{neigh}}\textsuperscript{\textsuperscript{\textit{k},(\textit{k}-1,\textit{k}-2)}},\textit{S}\textsuperscript{$\star$})\\*};
\node (prc5) [process, below of=prc4,node distance=1.5cm] {\footnotesize Calculate new mass\\*\textit{m} = $f$\textsubscript{4}(x\textsuperscript{\textit{k}},$\Delta$x)};
\node (dec1) [decision, below of=prc5, node distance=2.75cm] {\footnotesize \setstretch{0.75} Mass check\\* $|$\textit{m}\textsuperscript{$\star$} - \textit{m}$|$ $<$ $\varepsilon$\textsubscript{inner}\\*\text{j} $>$ \textit{n}\textsubscript{\textit{it},max,inner}\\*};
\node (prc6) [process, left of=prc5, node distance=5.5cm] {\footnotesize Update state setpoint\\*\textit{S}\textsuperscript{$\star$}=$f$\textsubscript{5}(\textit{S}\textsuperscript{$\star$},\textit{m},\textit{m}\textsuperscript{$\star$})};
\node (prc7) [process, below of=dec1, node distance=3cm] {\footnotesize Force size variables to respect limits\\*$\Delta$x = $f$\textsubscript{6}(x\textsuperscript{\textit{k}},\textit{m}\textsuperscript{$\star$},\textit{m} ,x\textsuperscript{\textit{L}},x\textsuperscript{\textit{U}} )};
\node (dec2) [decision, below of=prc7, node distance=3cm] {\footnotesize \setstretch{0.5} Convergence\\* $\Delta$\textit{m} $<$ $\varepsilon$\textsubscript{outer}\\* \textit{k} $>$ \textit{n}\textsubscript{\textit{it},max}\\*};
\node (prc8) [io, below of=dec2, node distance=3cm] {\footnotesize Optimum design};
\draw [arrow] (Initials)--(prc1);
\draw [arrow] (prc1)--(prc2);
\draw [arrow] (prc2)--(prc3);
\draw [arrow] (prc3)--(prc9);
\draw [arrow] (prc4)--(prc5);
\draw [arrow] (prc5)--(dec1);
\draw [arrow] (dec1)-| node[anchor=north] {j=j+$1$}(prc6);
\draw [arrow] (prc6)|-(prc4);
\draw [arrow] (dec1)--(prc7);
\draw [arrow] (prc7)--(dec2);
\draw [arrow] (dec2)--(prc8);
\draw [arrow] (dec2)-|node[anchor=north] {k=k+$1$}(4,-1.5)|-(prc1);
\draw [arrow] (prc9)--(prc4);
\end{tikzpicture}
\caption{Flowchart of Knowledge Based Rule Method }
\end{figure}
\par\end{center}
\begin{center}
\begin{figure}[H]
\usetikzlibrary{automata,positioning,shapes.geometric, arrows}
\tikzstyle{io} = [rectangle, rounded corners, minimum width= 3cm, minimum height=1cm,text width=5cm, text centered, draw=black, fill=green!40]
\tikzstyle{process} = [rectangle, minimum width= 3cm, minimum height=1cm, text width=5cm, text centered, draw=black, fill=blue!40]
\tikzstyle{NewProcess} = [rectangle, minimum width= 3cm, minimum height=1cm, text width=5cm, text centered, draw=black, fill=blue!60]
\tikzstyle{decision} = [diamond, minimum width=2cm,minimum height=1cm,text height=.25cm,text width=2.5cm, text centered, draw=black, fill=red!40]
\tikzstyle{arrow} = [->,>=stealth]
\begin{tikzpicture}[node distance=4cm]
\node (Initials) [io] {\footnotesize \setstretch{0.75} Initialization and\\*set iteration values\\*x\textsuperscript{0}, \textit{k} = 0\\*};
\node (prc1) [process, below of=Initials,node distance=1.5cm] {\footnotesize \setstretch{0.75} Calculate structural-mechanical responses via FEM\\* \setstretch{0.5} \textsuperscript{\textit{t}}\textbf{\textit{M}}\textsuperscript{\textit{t}}\textbf{\textit{ü}} + \textsuperscript{\textit{t}}\textbf{$f$}\textsuperscript{int} = \textsuperscript{\textit{t}}\textbf{$f$}\textsuperscript{ext}\setstretch{0.5}\\*};
\node (prc2) [process, below of=prc1,node distance=1.55cm] {\footnotesize Calculate target mass\\*\textit{m}\textsuperscript{$\star$,\textit{k}} = \textit{m}\textsuperscript{\textit{k}} + $\Delta$\textit{m}\textsuperscript{\text{k}}\setstretch{0.75}\\*where $\Delta$\textit{m} = \text{$f$\textsubscript{1}}(g)\\*};
\node (prc3) [process, below of=prc2,node distance=1.5cm] {\footnotesize \setstretch{0.75} Calculate state setpoint based on responses\\*\setstretch{0.5}\textit{S\textsuperscript{$\star$}} = $f$\textsubscript{2}(\textit{S\textsuperscript{\textit{k}}})\\*};
\node (prc9) [NewProcess, below of=prc3, node distance=1.55cm,minimum height=1.3cm]{\footnotesize Update Shape variables};
\node (prc4) [process, below of=prc9,node distance=1.6cm] {\footnotesize \setstretch{0.75} Loop over cells: update size variables by adding \\* $\Delta$x=$f$\textsubscript{3}(x\textsuperscript{\textit{k}},\textit{S}\textsubscript{\textsubscript{cell}}\textsuperscript{\textsuperscript{\textit{k},(\textit{k}-1,\textit{k}-2)}},\textit{S}\textsubscript{\textsubscript{neigh}}\textsuperscript{\textsuperscript{\textit{k},(\textit{k}-1,\textit{k}-2)}},\textit{S}\textsuperscript{$\star$})\\*};
\node (prc5) [process, below of=prc4,node distance=1.5cm] {\footnotesize Calculate new mass\\*\textit{m} = $f$\textsubscript{4}(x\textsuperscript{\textit{k}},$\Delta$x)};
\node (dec1) [decision, below of=prc5, node distance=2.75cm] {\footnotesize \setstretch{0.75} Mass check\\* $|$\textit{m}\textsuperscript{$\star$} - \textit{m}$|$ $<$ $\varepsilon$\textsubscript{inner}\\*\text{j} $>$ \textit{n}\textsubscript{\textit{it},max,inner}\\*};
\node (prc6) [process, left of=prc5, node distance=5.5cm] {\footnotesize Update state setpoint\\*\textit{S}\textsuperscript{$\star$}=$f$\textsubscript{5}(\textit{S}\textsuperscript{$\star$},\textit{m},\textit{m}\textsuperscript{$\star$})};
\node (prc7) [process, below of=dec1, node distance=3cm] {\footnotesize Force size variables to respect limits\\*$\Delta$x = $f$\textsubscript{6}(x\textsuperscript{\textit{k}},\textit{m}\textsuperscript{$\star$},\textit{m} ,x\textsuperscript{\textit{L}},x\textsuperscript{\textit{U}} )};
\node (dec2) [decision, below of=prc7, node distance=3cm] {\footnotesize \setstretch{0.5} Convergence\\* $\Delta$\textit{m} $<$ $\varepsilon$\textsubscript{outer}\\* \textit{k} $>$ \textit{n}\textsubscript{\textit{it},max}\\*};
\node (prc8) [io, below of=dec2, node distance=3cm] {\footnotesize Optimum design};
\draw [arrow] (Initials)--(prc1);
\draw [arrow] (prc1)--(prc2);
\draw [arrow] (prc2)--(prc3);
\draw [arrow] (prc3)--(prc9);
\draw [arrow] (prc4)--(prc5);
\draw [arrow] (prc5)--(dec1);
\draw [arrow] (dec1)-| node[anchor=north] {j=j+$1$}(prc6);
\draw [arrow] (prc6)|-(prc4);
\draw [arrow] (dec1)--(prc7);
\draw [arrow] (prc7)--(dec2);
\draw [arrow] (dec2)--(prc8);
\draw [arrow] (dec2)-|node[anchor=north] {k=k+$1$}(4,-1.5)|-(prc1);
\draw [arrow] (prc9)--(prc4);
\end{tikzpicture}
\caption{Flowchart of Knowledge Based Rule Method }
\end{figure}
\par\end{center}
\end{document}
答案1
您不应该\usetikzlibrary
在文档本身中使用。删除以下行
\usetikzlibrary{automata,positioning,shapes.geometric, arrows}
从文档的两个位置,并将其放置在序言中(文档 --> 设置 --> LaTeX 序言),之后\usepackage{tikz}
。
我认为你也可以将所有样式声明移至序言中,这样就无需重复了。因此,删除所有声明\tikzstyle
,并添加
\tikzset{
io/.style={rectangle, rounded corners, minimum width= 3cm, minimum height=1cm,text width=5cm, text centered, draw=black, fill=green!40},
process/.style={rectangle, minimum width= 3cm, minimum height=1cm, text width=5cm, text centered, draw=black, fill=blue!40},
NewProcess/.style={rectangle, minimum width= 3cm, minimum height=1cm, text width=5cm, text centered, draw=black, fill=blue!60},
decision/.style={diamond, minimum width=2cm,minimum height=1cm,text height=.25cm,text width=2.5cm, text centered, draw=black, fill=red!40},
arrow/.style={->,>=stealth}
}
回到序言。