Knowledge indicators
Building on A.Ellet's answer
to produce something as required (three rectangles always in each group; green ones will show the skill level):
The code:
\documentclass{article}
\usepackage{tikz}
\definecolor{colori}{RGB}{249,193,158}
\definecolor{colorii}{RGB}{158,214,149}
\newcommand\skilllevel[1]{%%
\begin{tikzpicture}
\foreach \Val in {1,2,3}
{
\node[fill=colori,inner ysep=0pt]
at ([yshift=2*\Val]0,\Val pt) {};
}
\foreach \Val in {1,...,#1}
{
\node[fill=colorii,inner ysep=0pt]
at ([yshift=2*\Val]0,\Val pt) {};
}
\end{tikzpicture}%
}
\makeatother
\begin{document}
\noindent\begin{tabular}{lc}
German & \skilllevel{2} \\
Latin & \skilllevel{1} \\
Japanese & \skilllevel{3} \\
\end{tabular}
\end{document}
Perhaps the following modification is less confusing (see Andrew Cashner's comment
):
\documentclass{article}
\usepackage{tikz}
\definecolor{colori}{RGB}{249,193,158}
\definecolor{colorii}{RGB}{158,214,149}
\newcommand\skilllevel[1]{%%
\begin{tikzpicture}
\foreach \Val in {1,2,3}
{
\node[draw,fill=white,inner ysep=1pt]
at ([yshift=2*\Val]0,\Val pt) {};
}
\foreach \Val in {1,...,#1}
{
\node[draw,fill=colorii,inner ysep=1pt]
at ([yshift=2*\Val]0,\Val pt) {};
}
\end{tikzpicture}%
}
\begin{document}
\noindent\begin{tabular}{lc}
German & \skilllevel{2} \\
Latin & \skilllevel{1} \\
Japanese & \skilllevel{3} \\
\end{tabular}
\end{document}
Just for fun, with picture
mode:
\documentclass{article}
\usepackage{xcolor}
\newcommand{\skill}[1][3]{%
\setlength{\unitlength}{1ex}%
\begin{picture}(1,1.8)
\linethickness{0.3ex}%
\textcolor{gray!15}{\multiput(0, 0.15)(0, 0.6){3}{\line(1,0){1}}}
\multiput(0, 0.15)(0, 0.6){#1}{\line(1,0){1}}
\end{picture}%
}
\begin{document}
\begin{itemize}
\item German \skill[3]
\item English \skill[2]
\item Chinese \skill[1]
\item Default \skill
\end{itemize}
Testing \skill[1], winning \skill[2], and excellence \skill[3].
\end{document}
With stacks. I have chosen to keep the answer within the confines of normal line spacing, but that can be changed by invoking \setstackgap{L}{desired-baselineskip}
. The bar thicknesses (1pt) and widths (1ex) are set within the \rl
and \rlf
definitions (as well as the colors). The vertical space between bars is set with \setstackgap{S}{1.5pt}
and the gap between the words and the bars is set via \setstacktabbedgap{1ex}
.
\documentclass{article}
\usepackage{tabstackengine,xcolor}
\def\rl{\textcolor{red}{\protect\rule{1ex}{1pt}}}
\def\rlf{\textcolor{red!15}{\protect\rule{1ex}{1pt}}}
\newcommand\level[1]{%
\if 1#1\stackon{\stackon{\rl}{\rlf}}{\rlf}\else
\if 2#1\stackon{\stackon{\rl}{\rl}}{\rlf}\else
\if 3#1\stackon{\stackon{\rl}{\rl}}{\rl}\else
\fi\fi\fi
}
\begin{document}
\renewcommand\stackalignment{l}
\setstackgap{S}{1.5pt}
\setstacktabbedgap{1ex}
\tabbedLongstack{German&\level{3}\\Latin&\level{2}\\Japanese&\level{1}}
\end{document}
If one doesn't feel confortable with TABstacks, ordinary stacks can be used to achieve the same result by
\Longstack{German\\Latin\\Japanese}%
\hspace{1ex}%
\Longstack{\level{3}\\\level{2}\\\level{1}}