I am building a résumé on which I would like to list the languages I speak and my level in each one of them. To present the levels, I wish to use skill dots. I want to obtain a structure similar to the one shown in the image below

enter image description here

To do so, I defined a new command named \cvlanguages on a .cls file :

\newcommand{\cvlanguages}[2]{\renewcommand{\cvlanguages}{#1 \grade{#2}}}

Later on the .cls code, in order to print the "Languages" section on the résumé, I use the following:


\profilesection is defined elsewhere and is not important here.

The \grade command is also on the .cls file and is given by:

        \clip (1em-.4em,-.35em) rectangle (5em +.5em ,1em);
        \foreach \x in {1,2,...,5}{
            \path[{fill=backColor}] (\x em,0) circle (.35em);
            \clip (1em-.4em,-.35em) rectangle (#1 em +.5em ,1em);
            \foreach \x in {1,2,...,5}{
            \path[{fill=frontColor}] (\x em,0) circle (.35em);

On the .tex file, I use the following line to call the \cvlanguages command:


This procedure causes a fatal error and I have no idea why. The command \grade works perfectly when it is outside the \renewcommand nested in the \newcommand.

I have considered an alternative solution using something like this instead:

    {\fontsize{0.36cm}{0.432cm} \selectfont \cvlanguages{#1} \grade{\cvlanguages{#2}}}

but I have no idea how to make this work, as specifying which argument to print using "#" doesn't seem to work inside this \ifthenelse environment.

I am new to this level of LaTex and have spent a while trying to figure this out, with no success. I would appreciate any help on how to work around this problem.

  • 2
    \ifthenelse doesn't care about #1, #2, etc. These, when used in the replacement text of a macro, are replaced by the corresponding arguments when said macro is expanded. IMHO, you should provide one file (code block) containing your code, as short as possible. Something self-contained. You can use the filecontents (or filecontents*) environment if you really need several files. Otherwise, it is just complicated and fuzzy for us to guess how each part is used and what fails in which way.
    – frougon
    Aug 7 '19 at 22:25
  • 1
    It's hard to tell without a full example document, but only from your code snippets my best guess is that at some point \cvlanguages is defined to call itself when expanded, thus bringing the compiler into an infinite loop. Also, what's the purpose of the test \equal{\cvlanguages}{}}? Given either of your definitions for \cvlanguages, this command can never produce an empty token list.
    – siracusa
    Aug 8 '19 at 0:04

Initially \cvlanguages is defined to consume two non delimited macro arguments and to redefine itself.
This redefining can happen exactly once.
When this redefining happens, then \cvlanguages is redefined not to consume any macro argument and to expand to something like the phrase "Portugese \grade{5}" and thus is not "redefinable" any more.

This means:

  1. You can use \cvlanguages exactly once with two non delimited macro arguments for setting one language.
    After that you can use \cvlanguages without macro arguments for listing that one language and the skill-dots.

  2. If you did not use \cvlanguages exactly once with two non delimited macro arguments for setting one language, then \cvlanguages is still defined to consume two non delimited macro arguments. This circumstance may/will disturb the comparison of \cvlanguages's expansion to emptiness within the \ifthenelse-construct.

I suggest using the \@starttoc-mechanism:

In the example below the macro \cvlanguages is used for adding a language and a grade to the list of cvlanguages and the macro \listofcvlanguages is used for delivering the list of cvlanguages:


% As you didn't provide definitions for these, I invented something on my own:

      \clip (1em-.4em,-.35em) rectangle (5em +.5em ,1em);%
      \foreach \x in {1,2,...,5}{%
          \path[{fill=backColor}] (\x em,0) circle (.35em);%
          \clip (1em-.4em,-.35em) rectangle (#1 em +.5em ,1em);%
          \foreach \x in {1,2,...,5}{%
          \path[{fill=frontColor}] (\x em,0) circle (.35em);%

  \ifnum\cvlanguagecountmacro<1 \else
     \ifnum\cvlanguagecountmacro<2 %


Some text.




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.