答案1
为了好玩,下面是使用visualcounter
ConTeXt 中的模块(完整披露:我是该模块的作者)。
\usemodule[visualcounter]
\definepalet
[ratings]
[
active=black,
past=black,
future=gray,
]
\definevisualcounter
[ratings]
[markers]
[
last=8,
palette=ratings,
]
\starttext
\starttabulate[|l|l|]
\NC Adobe Photoshop \NC \usevisualcounter[n=7]{ratings} \NC \NR
\NC Adobe Illustrator \NC \usevisualcounter[n=8]{ratings} \NC \NR
\NC Adobe Indesign \NC \usevisualcounter[n=7]{ratings} \NC \NR
\stoptabulate
\stoptext
这使
答案2
答案3
非常基本的风格tikz
,不是太复杂。
\documentclass{article}
\newcounter{numofdots}
\usepackage{tikz}
\def\myscale{0.5}
\begin{document}
\begin{description}
\item[Adobe Photoshop]\hfill
\begin{tikzpicture}
\setcounter{numofdots}{7}
\foreach \x in {1,...,8} {%
\ifnum \x > \value{numofdots}
\draw[fill=gray,gray] (\x*\myscale,-1) circle (0.1cm);
\else
\draw[fill=black] (\x*\myscale,-1) circle (0.1cm);
\fi
}
\end{tikzpicture}
\item[Adobe Illustrator]\hfill
\begin{tikzpicture}
\setcounter{numofdots}{8}
\foreach \x in {1,...,8} {%
\ifnum \x > \value{numofdots}
\draw[fill=gray,gray] (\x*\myscale,-1) circle (0.1cm);
\else
\draw[fill=black] (\x*\myscale,-1) circle (0.1cm);
\fi
}
\end{tikzpicture}
\item[Adobe Indesign]\hfill
\begin{tikzpicture}
\setcounter{numofdots}{7}
\foreach \x in {1,...,8} {%
\ifnum \x > \value{numofdots}
\draw[fill=gray,gray] (\x*\myscale,-1) circle (0.1cm);
\else
\draw[fill=black] (\x*\myscale,-1) circle (0.1cm);
\fi
}
\end{tikzpicture}
\end{description}
\end{document}
更新
easier
有用的东西:
\documentclass{article}
\newcounter{numofdots}
\newcommand{\showdots}[3][gray]{%
\begin{tikzpicture}
\foreach \x in {1,...,#2} {%
\ifnum \x > #3
\draw[fill=#1,#1] (\x*\myscale,-1) circle (0.1cm);
\else
\draw[fill=black] (\x*\myscale,-1) circle (0.1cm);
\fi
}
\end{tikzpicture}%
}
\usepackage{tikz}
\def\myscale{0.5}
\begin{document}
\begin{tabular}{ll}
Adobe Photoshop & \showdots{8}{7}\tabularnewline
Adobe Illustrator &\showdots{8}{8}\tabularnewline
Adobe Indesign & \showdots[red]{8}{7} \tabularnewline
\LaTeXe & \showdots[gray]{15}{15} \tabularnewline
Word & \showdots[gray]{15}{0} \tabularnewline
\end{tabular}
\end{document}
再次更新-- 只使用plain
循环而不是Ti*k*Z
\documentclass{article}
\usepackage{xcolor}
\newcounter{numofdots}
\newcommand{\showdots}[3][gray]{%
\setcounter{numofdots}{0}
\loop\unless\ifnum\value{numofdots} = #2
\stepcounter{numofdots}%
\ifnum\value{numofdots} > #3
{\color{#1}\textbullet\hskip0.5em}%
\else
\textbullet\hskip0.5em%
\fi
\repeat%
\hfill
}
\def\myscale{0.5}
\begin{document}
\begin{tabular}{ll}
Adobe Photoshop & \showdots{8}{7}\tabularnewline
Adobe Illustrator &\showdots{8}{8}\tabularnewline
Adobe Indesign & \showdots[red]{8}{7} \tabularnewline
\LaTeXe & \showdots[gray]{15}{15} \tabularnewline
Word & \showdots[gray]{15}{0} \tabularnewline
\end{tabular}
\end{document}
答案4
没有 TikZ 且没有循环:
\documentclass{article}
\usepackage{xcolor}
\usepackage{tabto}
\TabPositions{\dimexpr0.5\linewidth-10.001em, \dimexpr0.5\linewidth}
\def\score#1#2{\tab\makebox[10em][l]{\sffamily #1}\tab%
\makebox[#2em]{\cleaders\hbox to 1em{\Large\hss$\bullet$\hss}\hfill}%
\makebox[\dimexpr10em-#2em]{\color{gray}\cleaders%
\hbox to 1em{\Large\hss$\bullet$\hss}\hfill}\par}
\begin{document}
\score{Above roof}{5}
\score{Above ground level}{2}
\score{Above clouds}{9}
\end{document}