I have this macro for showing rating/review. In the macro, it's a star symbol which works great. I tried to change star symbol to circle but it did not work as I expected. I would like to see circle symbol instead of star symbol in rating. Thanks in advance for all the help.
Following is MWE:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,calc}
\newcommand\score[2]{
\pgfmathsetmacro\pgfxa{#1+1}
\tikzstyle{scorestars}=[star, star points=5, star point ratio=2.25, draw, inner sep=0.15em,anchor=outer point 3]
\begin{tikzpicture}[baseline]
\foreach \i in {1,...,#2} {
\pgfmathparse{(\i<=#1?"blue!70":"lightgray")}
\edef\starcolor{\pgfmathresult}
\draw (\i*1em,0) node[name=star\i,scorestars,fill=\starcolor] {};
}
\pgfmathparse{(#1>int(#1)?int(#1+1):0}
\let\partstar=\pgfmathresult
\ifnum\partstar>0
\pgfmathsetmacro\starpart{#1-(int(#1))}
\path [clip] ($(star\partstar.outer point 3)!(star\partstar.outer point 2)!(star\partstar.outer point 4)$) rectangle
($(star\partstar.outer point 2 |- star\partstar.outer point 1)!\starpart!(star\partstar.outer point 1 -| star\partstar.outer point 5)$);
\fill (\partstar*1em,0) node[scorestars,fill=blue!70] {};
\fi,
\end{tikzpicture}
}
\begin{document}
\section*{Languages}
\textbf{English}\hspace{-1mm}\small{\score{5}{5}}\\
\textbf{Spanish}\hspace{-1mm}\small{\score{2.4}{5}}\\
\textbf{French}\hspace{-1mm}\small{\score{1.5}{5}}
\end{document}
Best Answer
Following code uses
circle
instead ofstar
and adjust clipping corners fromstar
tocircle
.