mirror of
https://github.com/moderncv/moderncv.git
synced 2026-10-20 08:17:03 +02:00
Update moderncvskillmatrix.sty
This commit is contained in:
parent
fdbca7c885
commit
870c8fd4b4
1 changed files with 55 additions and 11 deletions
|
|
@ -219,8 +219,11 @@
|
|||
\DeclareOption{moderncvbodyv}{\@moderncvbodyifalse\@moderncvbodyiifalse\@moderncvbodyiiifalse\@moderncvbodyivfalse\@moderncvbodyvtrue}
|
||||
|
||||
% If option `circle` is specified, use circles instead of small rectangles for rating skills
|
||||
% If option `halfcircle` is specified, allows for half-filled circles
|
||||
\@initializeif{\if@cvskillcircle}\@cvskillcirclefalse
|
||||
\@initializeif{\if@cvskillhalfcircle}\@cvskillhalfcirclefalse
|
||||
\DeclareOption{circle}{\@cvskillcircletrue}
|
||||
\DeclareOption{halfcircle}{\@cvskillhalfcircletrue}
|
||||
|
||||
\DeclareOption*{}% avoid choking on unknown options
|
||||
\ExecuteOptions{moderncvbodyi}
|
||||
|
|
@ -239,15 +242,30 @@
|
|||
% %-------------------------------------------------------------------------------
|
||||
% The code for the Skilllevel illustration with the little boxes.
|
||||
% This is idea stolen from the limecv package, see https://github.com/opieters/limecv.git
|
||||
|
||||
\@initializelength{\cvSkill@ShapeSize}
|
||||
\if@cvskillcircle%
|
||||
\setlength{\cvSkill@ShapeSize}{.7ex}%
|
||||
\setlength{\cvSkill@ShapeSize}{.8ex}%
|
||||
\def\cvSkill@Shape#1{\tikz\filldraw[#1] (0, 0) circle (\cvSkill@ShapeSize);}
|
||||
\else\if@cvskillhalfcircle%
|
||||
\setlength{\cvSkill@ShapeSize}{.8ex}%
|
||||
\newcommand*\cvSkill@FullCircle[1][\cvSkill@ShapeSize]{%
|
||||
\tikz\filldraw[skillmatrixfullcolor] (0,0) circle (#1);%
|
||||
}
|
||||
\newcommand*\cvSkill@HalfCircle[1][\cvSkill@ShapeSize]{%
|
||||
\tikz{%
|
||||
\fill[skillmatrixfullcolor] (0,0) -- (90:#1) arc (90:270:#1) -- cycle;%
|
||||
\fill[skillmatrixemptycolor] (0,0) -- (-90:#1) arc (-90:90:#1) -- cycle;%
|
||||
}%
|
||||
}
|
||||
\newcommand*\cvSkill@EmptyCircle[1][\cvSkill@ShapeSize]{%
|
||||
\tikz\filldraw[skillmatrixemptycolor] (0,0) circle (#1);%
|
||||
}
|
||||
\else
|
||||
\setlength{\cvSkill@ShapeSize}{1.2ex}
|
||||
\def\cvSkill@Shape#1{\tikz\filldraw[#1] (0, 0) rectangle (\cvSkill@ShapeSize, \cvSkill@ShapeSize);}
|
||||
\fi
|
||||
\newcount\my@repeat@count
|
||||
\fi\fi
|
||||
|
||||
\DeclareDocumentCommand{\cvskill}{m}{%
|
||||
% Illustrate skill level with little colored boxes.
|
||||
% By default five skill levels are predefined.
|
||||
|
|
@ -256,14 +274,40 @@
|
|||
% integer between 0 and 5
|
||||
% Example usage:
|
||||
% \cvskill{3}
|
||||
\begingroup
|
||||
\my@repeat@count=\z@
|
||||
\@whilenum\my@repeat@count<#1\do{\cvSkill@Shape{skillmatrixfullcolor}\advance%
|
||||
\my@repeat@count\@ne\,}%
|
||||
\my@repeat@count=\numexpr5-\z@\relax
|
||||
\@whilenum\my@repeat@count>#1\do{\cvSkill@Shape{skillmatrixemptycolor}\advance%
|
||||
\my@repeat@count\m@ne\,}%
|
||||
\endgroup
|
||||
% Option "circle" replaces the boxes by circles
|
||||
% Option "halfcircle" allows for half-integer values for half-filled circles
|
||||
\begingroup
|
||||
\if@cvskillhalfcircle%
|
||||
\pgfmathtruncatemacro{\full}{floor(#1)}% number of full circles
|
||||
\pgfmathparse{(#1-\full) > 0.01 ? 1 : 0}%
|
||||
\let\half\pgfmathresult% number of half circles
|
||||
\pgfmathtruncatemacro{\empty}{5-\full-\half}% number of empty circles
|
||||
\ifnum\full>0%
|
||||
\foreach \z in {1,...,\full}%
|
||||
{\cvSkill@FullCircle\,}%
|
||||
\fi%
|
||||
\ifnum\pgfmathresult=1%
|
||||
{\cvSkill@HalfCircle\,}%
|
||||
\fi%
|
||||
\ifnum\empty>0%
|
||||
\foreach \z in {1,...,\empty}%
|
||||
{\cvSkill@EmptyCircle\,}%
|
||||
\fi%
|
||||
\else
|
||||
% Only full shapes
|
||||
\newcount\my@repeat@count
|
||||
\my@repeat@count=\z@
|
||||
\@whilenum\my@repeat@count<#1\do{%
|
||||
\cvSkill@Shape{skillmatrixfullcolor}%
|
||||
\advance\my@repeat@count\@ne\,%
|
||||
}%
|
||||
\my@repeat@count=\numexpr5-\z@\relax
|
||||
\@whilenum\my@repeat@count>#1\do{%
|
||||
\cvSkill@Shape{skillmatrixemptycolor}%
|
||||
\advance\my@repeat@count\m@ne\,%
|
||||
}%
|
||||
\fi
|
||||
\endgroup
|
||||
}% end \cvskill
|
||||
|
||||
% %-------------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue