我有这段代码,在独立运行中可以正常工作,但当它嵌入到我的文章中时会出现以下错误
Package PGF Math Error: Sorry, the operation 'div' has not yet been implemented in the floating point unit (in '{-1-div(1,4)}'). }
Illegal unit of measure (pt inserted). }
工作代码是:
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}
[ cnode/.style={draw=black,fill=#1,minimum width=1mm,circle},
]
\node[cnode=white,draw=green,label=0:$O_1$] (s1) at (6,-3.25) {};
\node[cnode=white,draw=green,label=0:$O_2$] (s2) at (6,-2.25) {};
\node at (0.0,-4) {$\vdots$};
\node at (1,-4) {$\vdots$};
\node at (2,-4) {$\vdots$};
\node at (3,-4) {$\vdots$};
\node at (4.0,-4) {$\vdots$};
\node at (5,-4) {$\vdots$};
\foreach \x in {1,...,4}
{ \pgfmathparse{\x<4 ? \x : "n"}
\node[cnode=white,draw=blue,label=180:$x_{\pgfmathresult}$] (x-\x) at (0,{-\x-div(\x,4)}) {};
\node[cnode=white,draw=orange,label=90:] (A-\x) at (1,{-\x-div(\x,4)}) {};
\node[cnode=white,draw=orange,label=90:] (B-\x) at (2,{-\x-div(\x,4)}) {};
\node[cnode=white,draw=orange,label=90:] (C-\x) at (3,{-\x-div(\x,4)}) {};
\node[cnode=white,draw=orange,label=90:] (D-\x) at (4,{-\x-div(\x,4)}) {};
\node[cnode=white,draw=orange,label=90:] (E-\x) at (5,{-\x-div(\x,4)}) {};
\draw (E-\x) -- node[above,sloped,pos=0.53] {} (s1);
\draw (E-\x) -- node[above,sloped,pos=0.3] {} (s2);
}
\foreach \x in {1,...,4}
{ \foreach \y in {1,...,4}
{ \draw (x-\x) -- (A-\y);
\draw (A-\x) -- (B-\y);
\draw (B-\x) -- (C-\y);
\draw (C-\x) -- (D-\y);
\draw (D-\x) -- (E-\y);
}
}
\node[above=.1cm] at (A-1) {$H_1$};
\node[above=.1cm] at (B-1) {$H_2$};
\node[above=.1cm] at (C-1) {$H_3$};
\node[above=.1cm] at (D-1) {$H_4$};
\node[above=.1cm] at (E-1) {$H_5$};
\end{tikzpicture}
\end{document}
以下是文章序言
\documentclass[%
draft,
%submission,
%compressed,
%final,
%
%technote,
%internal,
%submitted,
%inpress,
%reprint,
%
%titlepage,
notitlepage,
%anonymous,
narroweqnarray,
inline,
twoside,
%invited,
]{IEEEtran}
\usepackage{tikz}
\usepackage{cleveref}
\usepackage{booktabs}
\usepackage[]{mcode}
\usetikzlibrary{matrix,fit}
\usepackage{amsmath}
\usepackage{paralist}
\usepackage{pgfplots}
\usetikzlibrary{patterns,decorations.pathmorphing}
\usetikzlibrary{decorations.markings}
\usepackage{enumerate}
\usepackage{array}
\usepackage{multirow}
\usepackage[caption=false]{subfig}
\usepackage{graphicx}
\usetikzlibrary{decorations.text}
\usetikzlibrary{arrows}
\usetikzlibrary{intersections, calc, fpu, decorations.pathreplacing}
\usepackage[acronym]{glossaries}
\usepackage{cite}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\AtBeginEnvironment{align}{\setcounter{subeqn}{0}}% Reset subequation number at start of align
\newcounter{subeqn} \renewcommand{\thesubeqn}{\theequation\alph{subeqn}}%
\newcommand{\subeqn}{%
\refstepcounter{subeqn}% Step subequation number
\tag{\thesubeqn}% Label equation
}
\makeglossaries
.
.
.
.