I came across this line in the awesome-cv document class
\def\@sectioncolor#1#2#3{%
\ifbool{acvSectionColorHighlight}{{\color{awesome}#1#2#3}}{#1#2#3}%
}
\newcommand*{\sectionstyle}[1]{{\fontsize{16pt}
{1em}\bodyfont\bfseries\color{text}\@sectioncolor #1}}
What it does is that you give it a word and it changes the colour of the first three letters of the word.
However, I don't understand how it works. Could someone please describe it to me?
Without considering the definitions in their entirety, focus on the following:
\def\@sectioncolor#1#2#3{%
% <some definition>
}
\newcommand*{\sectionstyle}[1]{{%
% <some definition>
\@sectioncolor #1}}
It should be obvious that \sectionstyle
takes a single, mandatory argument. This mandatory argument is the title of the section, as in \sectionstyle{Education}
for example. This argument is passed to \@sectioncolor
via
\@sectioncolor #1
However, note that there are no braces around #1
, since \@sectioncolor
expects three mandatory arguments. To that end, a call like \sectionstyle{Education}
translates to
\@sectioncolor Education
where \@sectioncolor
takes the first three tokens as its mandatory argument. That is, one can almost assume the following transferred input:
\@sectioncolor {E}{d}{u}cation
Within \@sectioncolor
's definition, E
would be #1
, d
would be #2
and u
would be #3
. They are set in sequence #1#2#3
if you don't want your sections highlighted by colour, or they're coloured using the colour awesome
if you do.