6

I have taken the solution of In-line graphics in the text to represent a loading bar for language skills in a CV and adapted to my current resume. Although I only use three levels and I like the result, it still consumes a lot of space.

So, I want to put a small graph chart next to the skills, like this:

enter image description here

Could you help me to create a command to do that?

9

Here tikz is overkill. The bar graph can be realized with \rule. The xcolor package is needed to get the lighter color. The command \skillevel adapts automatically to the current font height (with \settoheight) and the current color. The argument is the number of bars with the current text color. The optional argument can be used change how much the color is lightened (0 - 100, the smaller number, the lighter the color).

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

\newdimen\slheight
\newcommand{\skillevel}[2][20]{%
  \begingroup
  \settoheight{\slheight}{M}%
  \ifnum#2=0\color{.!#1}\fi
  \rule{.1em}{.33333\slheight}\hspace{.1em}%
  \ifnum#2=1\color{.!#1}\fi
  \rule{.1em}{.66667\slheight}\hspace{.1em}%
  \ifnum#2=2\color{.!#1}\fi
  \rule{.1em}{\slheight}%
  \endgroup
}

\begin{document}
\textcolor{blue}{\textsf{\tiny\skillevel{0} \LaTeX}}
\textcolor{red}{\textsf{\skillevel{1} \LaTeX}}
\textcolor{teal}{\textsf{\skillevel{2} \LaTeX}}
\textcolor{green}{\textsf{\Large\skillevel{3} \LaTeX}}
\textcolor{cyan}{\textsf{\Huge\skillevel{2} \LaTeX}}
\end{document}

enter image description here

3
  • 1
    You may also have a look to the CTAN package sparklines: ctan.org/pkg/sparklines – Harald Lichtenstein Sep 16 '17 at 6:54
  • The result is amazing. However, as I found the graph a bit small I adjusted the height (among other values) to be greater than the font size. May I ask you, how can I create an offset of the graph from the row? I mean, to start the \rule under the row. – J. Javier Gálvez Sep 16 '17 at 8:03
  • Oh! I didn't notice that the \rule command have already that parameter: \rule[raise]{width}{thickness}. I added it to the code above and it works like a charm. – J. Javier Gálvez Sep 16 '17 at 8:17

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.