Skip to content

Instantly share code, notes, and snippets.

@n3ssuno
Last active September 26, 2021 10:12
Show Gist options
  • Save n3ssuno/cfd2ef18e23df087f069cf9007395eb8 to your computer and use it in GitHub Desktop.
Save n3ssuno/cfd2ef18e23df087f069cf9007395eb8 to your computer and use it in GitHub Desktop.
Visual scores for a CV in LaTeX. Use \score{x}{Y} to add Y squares of which x colored and the others white to your CV. You can use it in combination with https://github.com/xdanaux/moderncv, adding this file in your local folder and \include{scoring_squares} into the top-matter of your document. If you are planning to use it in other classes, un…
\usepackage{tikz}
% \definecolor{color1}{rgb}{0.76, 0.13, 0.28}
\usetikzlibrary{shapes.geometric}
\newcommand\score[2]{
\pgfmathsetmacro\pgfxa{#1+1}
\tikzstyle{score_squares}=[draw, rectangle, minimum width=6.5pt]
\begin{tikzpicture}[baseline]
\foreach \i in {1,...,#2} {
\pgfmathparse{(\i<=#1?"color1":"white")}
\edef\starcolor{\pgfmathresult}
\draw (\i*1.5ex,.8ex) node[name=square_\i, score_squares, fill=\starcolor] {};
}
\end{tikzpicture}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment