段落在 \pgffor@next 完成之前结束

段落在 \pgffor@next 完成之前结束

我不知道为什么我的程序不能正常运行,错误信息如下:

paragraph ended before \pgffor@next was complete

每个想法都有帮助,谢谢!!!

这是代码:

% Pie chart with colors
% Author: Henri Menke
\documentclass[tikz,border=10pt]{standalone}
\begin{document}
\def\angle{0}
\def\radius{4.8}
\def\cyclelist{{"orange","blue","red","green","magenta","yellow","cyan","purple",}}
\newcount\cyclecount \cyclecount=-1
\newcount\ind \ind=-1


\begin{tikzpicture}
 [nodes = {font=\sffamily}]
  \foreach \percent/\name in {
      12.5/Segmento1,
      12.5/Segmento2,
      12.5/Segmento3,
      12.5/Segmento4,
      12.5/Segmento5,
      12.5/Segmento6,
      12.5/Segmento7,
      12.5/Segmento8
   }
  \foreach \percentSIS in {
      9.57,
      8.54,
      7.81,
      4.62,
      5.58,
      3.49,
      8.36,
      7.53
   }

   {
     \ifx\percent\empty\else               % If \percent is empty, do nothing
       \global\advance\cyclecount by 1     % Advance cyclecount
       \global\advance\ind by 1            % Advance list index
        \ifnum7<\cyclecount                 % If cyclecount is larger than list
          \global\cyclecount=0              %   reset cyclecount and
         \global\ind=0                     %   reset list index
        \fi
       \pgfmathparse{\cyclelist[\the\ind]} % Get color from cycle list
       \edef\color{\pgfmathresult}         %   and store as \color
        % Draw angle and set labels
       \draw[fill={\color!50},draw={\color}] (0,0) -- (\angle:\radius)
         arc (\angle:\angle+\percent*3.6:\radius) -- cycle;
       \node at (\angle+0.5*\percent*3.6:0.85*\radius) {\percent\,\%};
       \node at (\angle+0.5*\percent*3.6:0.55*\radius) {\percentSIS\,\%};
       \node[pin=\angle+0.5*\percent*3.6:\name]
         at (\angle+0.5*\percent*3.6:\radius) {};
       \pgfmathparse{\angle+\percent*3.6}  % Advance angle
       \xdef\angle{\pgfmathresult}         %   and store in \angle
     \fi
   };



  \node[align=center,text width=3cm]{WWS};


  \draw[gray] (0,0) circle (3.5cm) circle (2cm);

\end{tikzpicture}
\end{document} 

答案1

据报道,错误消息位于第 34 行,该行是空白行(段落末尾),删除空白行即可消除错误。

相关内容