Add option for half-filled circles in skill matrix (#309)

* Update CHANGELOG

* Update moderncvskillmatrix.sty

* Update CHANGELOG

Add PR #

* Update moderncvskillmatrix.sty

Updates "circle" option to allow for half-filled circles

* Update CHANGELOG

Updating "circle" option instead of adding "halfcircle" option

* Update moderncv_userguide.tex

Describe the use of option "circle" for skill matrix

* Description of the 'circle' option for skill matrix

* Update template.tex

Add draft state and skill matrix symbol to document class options.
Give example of half-filled circle for half-integer skill level

* Update template.tex

Comment examples using half-filled circles in skill matrix for compatibility with styles not using the 'circle' option
This commit is contained in:
Ohachiyo 2026-09-26 00:24:27 +08:00 • committed by GitHub
commit c2374bcad4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 69 additions and 20 deletions

View file

@ -2,6 +2,7 @@ version next
- Upgrade to Fontawesome 7 (#270)
- Fix "Underfull \hbox (badness 10000)" warning in banking \subsection dotted
rules by adding \hss glue as in \dotfill (#307)
- Update "circle" option to allow for half-filled circles in skill matrix (#309)
version 2.6.1 (24 Jun 2026)
- Allow the customisation of the contemporary style (#297)

Binary file not shown.

View file

@ -237,7 +237,8 @@ where at most one value for each option can be passed to the document class:
\code{legalpaper}, \code{executivepaper}, \code{landscape} \\
\textbf{\code{font family}:} & \code{sans}, \code{roman} \\
\textbf{\code{font size}:} & \code{10pt}, \code{11pt} (default), \code{12pt} \\
\textbf{\code{draft/final}:} & \code{draft}, \code{final} (default)
\textbf{\code{draft/final}:} & \code{draft}, \code{final} (default) \\
\textbf{\code{skill level symbol}:} & \code{circle}, \code{square} (default)
\end{tabular}
\subsubsection*{Choosing a \texttt{moderncv} style and color}
@ -512,7 +513,9 @@ The required argument must be a number from 0 to 5.
\begin{lstlisting}
\cvskill{<0-5>}
\end{lstlisting}
This command can be used outside of the skill matrix, too.
This command can be used outside of the skill matrix, too.
If the option \code{square} (default) is passed when loading the document class, the skill level will be represented by filled and empty squares. If the option \code{circle} is passed, half-integer values ($0.5$, $1.5$, \emph{etc}) are allowed and the skill level will be represented by filled, half-filled and empty circles.
\paragraph{\code{\\cvskilllegend}}
A command for a legend for the skill matrix.
@ -553,7 +556,7 @@ Takes five optional arguments: post-padding width, level, skill label, years of
\paragraph{\code{\\cvskillentry}}
A command for an entry in the skill matrix.
Takes five required arguments: skill category, skill level (0 to 5), skill name, years of experience and a comment.
Takes five required arguments: skill category, skill level, skill name, years of experience and a comment.
Takes a single optional argument for the post-padding width.
\begin{lstlisting}
\cvskillentry*[<post-padding>]{<skill category>}{<0-5>}
@ -561,6 +564,7 @@ Takes a single optional argument for the post-padding width.
\end{lstlisting}
An optional asterisk toggles the inclusion of a dashed line.
\code{<post-padding>} must be a valid length like \code{1em} or \code{1ex}.
Skill level ranges from 0 to 5 with integer steps when using document class option \code{square}; or half-integer steps when using option \code{circle}.
How to make length adjustments to the skill matrix will be explained in section \ref{section:length:skillmatrix}.

View file

@ -219,6 +219,7 @@
\DeclareOption{moderncvbodyv}{\@moderncvbodyifalse\@moderncvbodyiifalse\@moderncvbodyiiifalse\@moderncvbodyivfalse\@moderncvbodyvtrue}
% If option `circle` is specified, use circles instead of small rectangles for rating skills
% This option also allows for half-filled circles
\@initializeif{\if@cvskillcircle}\@cvskillcirclefalse
\DeclareOption{circle}{\@cvskillcircletrue}
@ -237,33 +238,72 @@
% %-------------------------------------------------------------------------------
% % \cvskill command
% %-------------------------------------------------------------------------------
% The code for the Skilllevel illustration with the little boxes.
% The code for the Skilllevel illustration with the little boxes (or circles).
% This is idea stolen from the limecv package, see https://github.com/opieters/limecv.git
\@initializelength{\cvSkill@ShapeSize}
\if@cvskillcircle%
\setlength{\cvSkill@ShapeSize}{.7ex}%
\def\cvSkill@Shape#1{\tikz\filldraw[#1] (0, 0) circle (\cvSkill@ShapeSize);}
\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
\DeclareDocumentCommand{\cvskill}{m}{%
% Illustrate skill level with little colored boxes.
% By default five skill levels are predefined.
% Option "circle" replaces the boxes by circles
%
% Input:
% 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
% \cvskill{3} gives 3 filled boxes or circles and 2 empty
% \cvskill{3.5} gives 3 and a half filled circles and 1 and a half empty (only with option "circle")
\begingroup
\if@cvskillcircle%
\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 boxes
\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
% %-------------------------------------------------------------------------------

View file

@ -6,7 +6,7 @@
% available at http://www.latex-project.org/lppl/.
\documentclass[11pt,a4paper,sans]{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')
\documentclass[11pt,a4paper,sans]{moderncv} % possible options include font size ('10pt', '11pt' (default) and '12pt'), paper size ('a4paper' (default), 'letterpaper', 'a5paper', 'legalpaper', 'executivepaper' and 'landscape'), font family ('sans' and 'roman'), draft state ('draft', 'final' (default)) and skill level symbol ('circle', 'square' (default))
\moderncvcolor{cerulean} % color options 'black', 'blue' (default), 'burgundy', 'green', 'grey', 'orange', 'purple' and 'red'; for contemporary style use 'cerulean'
% moderncv themes
@ -200,7 +200,7 @@ Detailed achievements:
% \setcvskilllegendcolumns[\widthof{``Legend''}][0.45]
% \setcvskilllegendcolumns[0ex][0.46]% this is useful for the banking style
%% Add a legend if you are using \cvskill{<1-5>} command or \cvskillentry
%% Add a legend if you are using \cvskill{<0-5>} command or \cvskillentry
%% Usage \cvskilllegend[*][<post_padding>][<first_level>][<second_level>][<third_level>][<fourth_level>][<fifth_level>]{<name>}
% \cvskilllegend % insert default legend without lines
\cvskilllegend*[1em]{}% adjust post spacing
@ -227,9 +227,13 @@ Detailed achievements:
\cvskillentry{}{2}{Lilypond}{14}{So much sheet music! Man, I'm the best!}
\cvskillentry{}{3}{\LaTeX}{14}{Clearly I rock at \LaTeX}
\cvskillentry*{OS:}{3}{Linux}{2}{I only use Archlinux btw}% notice the use of the starred command and the optional
%\cvskillentry{}{4.5}{AmigaOS}{20}{I've been developing games most of my life}% Half-integer skill level possible when using document class option 'circle' (default in contemporary style)
\cvskillentry*[1em]{Methods}{4}{SCRUM}{8}{SCRUM master for 5 years}
%% \cvskill{<0-5>} command
% \cvitem{\textbackslash{cvskill}:}{Skills can be visually expressed by the \textbackslash{cvskill} command, e.g. \cvskill{2}}
% \cvskill{<0-5>} command
\cvitem{\textbackslash{cvskill}:}{Skills can be visually expressed outside the skill matrix by the \textbackslash{cvskill} command, e.g.
\cvskill{2}
%\cvskill{3.5} half-integer skill levels are possible only when using document class option 'circle' (default in contemporary style)
}
\section{Interests}
\cvitem{hobby 1}{Description}