I have a pie chart as below:
\documentclass[14pt,a4paper,san]{moderncv} % possible options include font size ('10pt', '11pt' and '12pt'), paper size ('a4paper', 'letterpaper', 'a5paper', 'legalpaper', 'executivepaper' and 'landscape') and font family ('sans' and 'roman')
\moderncvstyle{classic} % 选项参数是 ‘casual’, ‘classic’, ‘oldstyle’ 和 ’banking’
\moderncvcolor{blue} % 选项参数是 ‘blue’ (默认)、‘orange’、‘green’、‘red’、‘purple’ 和 ‘grey’
\name{a}{a}
\title{s}
\address{}{s}
\email{}
\phone[mobile]{1212}
\begin{document}
\cvitem{}{
\def\angle{0}
\def\radius{3}
\def\cyclelist{{"orange","blue","red","green"}}
\newcount\cyclecount \cyclecount=-1
\newcount\ind \ind=-1
\begin{tikzpicture}[nodes = {font=\sffamily}]
\foreach \percent/\name in {
8/C++,8/Linux,7/Arduino,6/Python,6/Erlang,5/H5
} {
\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
\ifnum3<\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*1.8*2.5:\radius) -- cycle;
\node at (\angle+0.5*\percent*1.8*2.5:0.7*\radius) {\name};
%\node[pin=\angle+0.5*\percent*3.6:\name]
% at (\angle+0.5*\percent*3.6:\radius) {};
\pgfmathparse{\angle+\percent*1.8*2.5} % Advance angle
\xdef\angle{\pgfmathresult} % and store in \angle
\fi
};
\end{tikzpicture}}
\clearpage
\end{document}
But when I copy them into \cvitem{}{$here}
. I got lots of error.
file: 'file:///c%3A/Users/erow/Documents/tex/cv1.tex' severity: '错误' message: 'Paragraph ended before \cvitem was complete \par l.74
' at: '74,1' source: 'LaTeX' code: 'undefined'file: 'file:///c%3A/Users/erow/Documents/tex/cv1.tex' severity: '错误' message: 'Undefined control sequence \pgffor@body ...else \global \advance \cyclecount by 1 \global \advance \ind... l.98 } ; c:/Users/erow/Documents/tex/cv1.tex:98: You can't use
the letter b' after \advance. \pgffor@body ...lse \global \advance \cyclecount b y 1 \global \advance \ind ... l.98 } ; c:/Users/erow/Documents/tex/cv1.tex:98: Undefined control sequence. \pgffor@body ...ecount by 1 \global \advance \ind by 1 \ifnum 3<\cyclecount ... l.98 } ; c:/Users/erow/Documents/tex/cv1.tex:98: You can't use
the letter b' after \advance. \pgffor@body ...count by 1 \global \advance \ind b y 1 \ifnum 3<\cyclecount ... l.98 } ; c:/Users/erow/Documents/tex/cv1.tex:98: Undefined control sequence. \pgffor@body ...ce \ind by 1 \ifnum 3<\cyclecount \global \cyclecount =0 \gl... l.98 } ; c:/Users/erow/Documents/tex/cv1.tex:98: Missing number, treated as zero. \global l.98 } ; c:/Users/erow/Documents/tex/cv1.tex:98: Undefined control sequence. \cyclelist [\the \ind ] l.98 } ; c:/Users/erow/Documents/tex/cv1.tex:98: Undefined control sequence. \cyclelist [\the \ind ] l.98 } ; c:/Users/erow/Documents/tex/cv1.tex:98: You can't use `the character ]' after \the. \cyclelist [\the \ind ]
' at: '98,1' source: 'LaTeX' code: 'undefined'
moderncv
package. You can install it in pakcage manager.