16

I'd like to implement icons like those in the figure below to denote, for instance, the level of satisfaction of a certain requirement.

enter image description here

I didn't find such icons in any icon pack. I also tried \mathrel but the circles are not perfectly concentric at the end. How can i solve?

Moreover, is there a way to create them deciding the ratio between the black circle and the white one?

Thank you in advance.

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – CarLaTeX Sep 28 '17 at 16:07
9

Package-free approach:

mwe

\documentclass{article}
\setlength{\unitlength}{1em}
\newcommand\like[1]{\begin{picture}(1,1)
\ifnum0=#1\put(.5,.35){\circle{1}}\else
\ifnum10=#1\put(.5,.35){\circle*{1}}\else
\put(.5,.35){\circle{1}}\put(.5,.35){\circle*{.#1}}
\fi\fi\end{picture}}

\begin{document}
I hate it \like{0} \like{1} \like{2} \like{3} \like{4} \like{5} 
\like{6} \like{7} \like{8} \like{9} \like{10}  I love it
\end{document}
21

How about this:

The command \satisfaction takes one parameter, which has to be a number from 0 to 4. And with the optional parameter, the color can be set. It scales with fontsize. And without optional parameter it takes the surrounding color.

enter image description here

The code:

\documentclass[10pt,a4paper]{article}
\usepackage{tikz}

\newdimen\satlevel
\newdimen\satdiameter
\newcommand{\satisfaction}[2][]{%
    \satdiameter=2.5ex\relax
    \ifcase#2\relax
        \satlevel=0pt\relax
    \or
        \satlevel=0.125\satdiameter
    \or
        \satlevel=0.25\satdiameter
    \or
        \satlevel=0.375\satdiameter
    \or
        \satlevel=0.5\satdiameter
    \fi
    \tikz[baseline=-0.3\satdiameter]{%
        \draw[#1] (0,0) circle (0.5\satdiameter);
        \fill[#1] (0,0) circle (\satlevel);
    }%
}
\begin{document}
M \satisfaction{0} M \satisfaction{1} M \satisfaction{2} M \satisfaction{3} M \satisfaction{4} M

\vspace{2ex}
M \satisfaction[blue]{0} M \satisfaction[blue]{1} M \satisfaction[blue]{2} M \satisfaction[blue]{3} M \satisfaction[blue]{4} M

\vspace{2ex}
{\Huge M \satisfaction[red]{0} M \satisfaction[red]{1} M \satisfaction[red]{2} M \satisfaction[red]{3} M \satisfaction[red]{4} M}

\vspace{2ex}
{\scriptsize M \satisfaction[cyan]{0} M \satisfaction[cyan]{1} M \satisfaction[cyan]{2} M \satisfaction[cyan]{3} M \satisfaction[cyan]{4} M}

\vspace{2ex}
\textcolor{green}{M \satisfaction{0} M \satisfaction{1} M \satisfaction{2} M \satisfaction{3} M \satisfaction{4} M}

\end{document}
9

A pstricks solution. I define 5 commands with an optional argument, the radius of the outer circle, which defaults to 0.75 em. You can change it via the key satradius. The colour (default: black) is changed with \psset{linecolor=some_colour}:

\documentclass[border=3pt, x11names]{standalone}
\usepackage{pstricks-add, cellspace}
\setlength{\cellspacetoplimit}{2pt}
\setlength{\cellspacebottomlimit}{2pt}
%
\usepackage{auto-pst-pdf}
\newlength{\satradius}
\makeatletter
\define@key[psset]{pstricks}{satradius}[0.75em]{\setlength{\satradius}{#1}}
\makeatother
\newcommand{\vlsat}{\raisebox{-0.4\height}{\begin{pspicture}\pscircle(0,0){\satradius}\end{pspicture}}}
\newcommand{\lsat}{\raisebox{-0.4\height}{\begin{pspicture}\pscircle(0,0){\satradius}\psscalebox{0.3}{\qdisk(0,0){\satradius}}\end{pspicture}}}
\newcommand{\msat}{\raisebox{-0.4\height}{\begin{pspicture}\pscircle(0,0){\satradius}\psscalebox{0.5}{\qdisk(0,0){\satradius}}\end{pspicture}}}
\newcommand{\hsat}{\raisebox{-0.4\height}{\begin{pspicture}\pscircle(0,0){\satradius}\psscalebox{0.75}{\qdisk(0,0){\satradius}}\end{pspicture}}}
\newcommand{\vhsat}{\raisebox{-0.4\height}{\begin{pspicture}\qdisk(0,0){\satradius}\end{pspicture}}}

\begin{document}

\psset{linecolor=Coral2, satradius=0.67em}
\begin{tabular}{|Sc|l|}%
    \hline
    \vlsat & Very low \\[2pt]
    \hline
    \lsat
           & Low \\[2pt]
    \hline
    \msat & Medium \\[2pt]
    \hline
    \hsat & High \\[2pt]
    \hline
    \vhsat & Very High \\[2pt]
    \hline
\end{tabular}

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.