3

In the moderncv casual theme, in the header, the family name has a darker color than the first name. How can I make it the other way around, and more generally, set each name to a color of my choosing?

1 Answer 1

3

For recent versions of moderncv you need to use

\usepackage{etoolbox}
\patchcmd{\makecvtitle}{\color{color2!50}\@firstname}{\color{color2}\@firstname}{}{}
\patchcmd{\makecvtitle}{\color{color2}\@lastname}{\color{color2!50}\@lastname}{}{}

(Thank you, Gonzalo Medina!)


The following applies only for version 2008/06/17 v0.7 of moderncv


The names are typeset by the commands

\firstnamestyle
\familynamestyle

which are defined in moderncv.cls as follows

\providecommand*{\firstnamestyle}[1]{{\firstnamefont\color{firstnamecolor}#1}}
\providecommand*{\familynamestyle}[1]{{\familynamefont\color{familynamecolor}#1}}

You can adjust them to your liking via

\renewcommand*{\firstnamestyle}[1]{{<whatever>#1}}
\renewcommand*{\familynamestyle}[1]{{<whatever>#1}}

If you just want to switch the colors, your call would be

\providecommand*{\firstnamestyle}[1]{{\firstnamefont\color{familynamecolor}#1}}
\providecommand*{\familynamestyle}[1]{{\familynamefont\color{firstnamecolor}#1}}
7
  • I don't seem to be able to locate \firstnamestyle or \familynamestyle in moderncv.cls. Perhaps those were the settings in previous versions? Commented Apr 22, 2014 at 16:31
  • @GonzaloMedina Mine is 2008/06/17 v0.7 with TL 2013 on Ubuntu 14.04. Commented Apr 22, 2014 at 16:32
  • Ah, that explains it. Mine is 2013/04/29 v1.5.1 (Tex Live2013). Commented Apr 22, 2014 at 16:36
  • @GonzaloMedina In the current CTAN version the color of first and last name is buried deep inside \makecvtitle. I will try to adjust this using xpatch. Commented Apr 22, 2014 at 16:36
  • Yes, I know. In the current version you need to do \patchcmd{\makecvtitle} {\color{color2!50}\@firstname} {\color{color2}\@firstname} {} {} \patchcmd{\makecvtitle} {\color{color2}\@lastname} {\color{color2!50}\@lastname} {} {} If you want to, you can add this to your answer. Commented Apr 22, 2014 at 16:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .