1

I have code that uses an old 2011 version of moderncv. The same code does not compile with the latest version (texlive 2015). I fail to find the new API to replace my old code.

This fails (command not found)

\renewcommand*{\firstnamefont}{\fontsize{28}{40}\sffamily\mdseries\upshape}
\renewcommand*{\familynamefont}{\firstnamefont}
\renewcommand*{\firstnamestyle}[1]{{\firstnamefont\color{firstnamecolor}#1}}
\renewcommand*{\familynamestyle}[1]{{\familynamefont\color{familynamecolor}#1}}

I found: \namefont and \namestyle, what about \familynamestyle ?

For

\color{firstnamecolor}
\color{sectionrectanglecolor}

I could not find a replacement.

1

These macros changed. See now for example file moderncvheadi.sty. In the lines 40-49 you find:

\renewcommand*{\namefont}{\fontsize{34}{36}\mdseries\upshape}
\renewcommand*{\titlefont}{\LARGE\mdseries\slshape}
\renewcommand*{\addressfont}{\small\mdseries\slshape}
\renewcommand*{\quotefont}{\large\slshape}

% styles
\renewcommand*{\namestyle}[1]{{\namefont\textcolor{color0}{#1}}}
\renewcommand*{\titlestyle}[1]{{\titlefont\textcolor{color2}{#1}}}
\renewcommand*{\addressstyle}[1]{{\addressfont\textcolor{color2}{#1}}}
\renewcommand*{\quotestyle}[1]{{\quotefont\textcolor{color1}{#1}}}

Colors:

% colors
%-------
\definecolor{color0}{rgb}{0,0,0}% main default color, normally left to black
\definecolor{color1}{rgb}{0,0,0}% primary scheme color
\definecolor{color2}{rgb}{0,0,0}% secondary scheme color
\definecolor{color3}{rgb}{0,0,0}% tertiary scheme color

or more in moderncvcolor?.sty

Which file contains the relevant definition for you depends on your used style.

Your two searched macros

\color{firstnamecolor}
\color{sectionrectanglecolor}

do not longer exist.

But you can use own code to get the same result.

Instead \color{firstnamecolor} use \name{\textcolor{red}{John}}{Doe} to get the first name in for example red color.

Instead \color{sectionrectanglecolor} you can redefine the command \section to use color red instead of standard color1:

\makeatletter
\RenewDocumentCommand{\section}{sm}{%
  \par\addvspace{2.5ex}%
  \phantomsection{}% reset the anchor for hyperrefs
  \addcontentsline{toc}{section}{#2}%
  \cvitem[0ex]{\strut\raggedleft\raisebox{\baseletterheight}{\color{red}\rule{\hintscolumnwidth}{0.95ex}}}{\strut\sectionstyle{#2}}% <== new color red
%                                                            ^^^^^^^^^^^
%\cvitem[0ex]{\strut\raggedleft\raisebox{\baseletterheight}{\color{color1}\rule{\hintscolumnwidth}{0.95ex}}}{\strut\sectionstyle{#2}}% <============== original line
  \par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
\makeatother

With the following complete MWE

\documentclass[11pt,a4paper,sans]{moderncv}

% moderncv themes
\moderncvstyle{casual}
\moderncvcolor{blue}
\nopagenumbers{}

\usepackage[utf8]{inputenc}

\usepackage[scale=0.75]{geometry}
%\setlength{\hintscolumnwidth}{3cm}
%\setlength{\makecvtitlenamewidth}{10cm}
\setlength{\footskip}{70pt}

% personal data
\name{\textcolor{red}{John}}{Doe} % <===================================

%\color{firstnamecolor} --> \name{\textcolor{red}{John}}{Doe}
%\color{sectionrectanglecolor}
%%\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{#1}}}
\makeatletter
\RenewDocumentCommand{\section}{sm}{%
  \par\addvspace{2.5ex}%
  \phantomsection{}% reset the anchor for hyperrefs
  \addcontentsline{toc}{section}{#2}%
  \cvitem[0ex]{\strut\raggedleft\raisebox{\baseletterheight}{\color{red}\rule{\hintscolumnwidth}{0.95ex}}}{\strut\sectionstyle{#2}}% <== new color red
%\cvitem[0ex]{\strut\raggedleft\raisebox{\baseletterheight}{\color{color1}\rule{\hintscolumnwidth}{0.95ex}}}{\strut\sectionstyle{#2}}% <============== original line
  \par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
\makeatother

\title{Resumé title}
\address{street and number}{postcode city}{country}
\phone[mobile]{+1~(234)~567~890}
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{john@doe.org}
\homepage{www.johndoe.com}
\social[linkedin]{john.doe}
\social[twitter]{jdoe}
\social[github]{jdoe}
\extrainfo{additional information}
\photo[64pt][0.4pt]{example-image-a}
\quote{Some quote}

%   to show numerical labels in the bibliography (default is to show no labels)
\makeatletter\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}\makeatother


\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\section{Master thesis}
\cvitem{title}{\emph{Title}}
\cvitem{supervisors}{Supervisors}
\cvitem{description}{Short thesis abstract}

\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines.\newline{}%
Detailed achievements:%
\begin{itemize}%
\item Achievement 1;
\item Achievement 2, with sub-achievements:
  \begin{itemize}%
  \item Sub-achievement (a);
  \item Sub-achievement (b), with sub-sub-achievements (don't do this!);
    \begin{itemize}
    \item Sub-sub-achievement i;
    \item Sub-sub-achievement ii;
    \item Sub-sub-achievement iii;
    \end{itemize}
  \item Sub-achievement (c);
  \end{itemize}
\item Achievement 3.
\end{itemize}}
\cventry{year--year}{Job title}{Employer}{City}{}{Description line 1\newline{}Description line 2}
\subsection{Miscellaneous}
\cventry{year--year}{Job title}{Employer}{City}{}{Description}

\section{Languages}
\cvitemwithcomment{Language 1}{Skill level}{Comment}
\cvitemwithcomment{Language 2}{Skill level}{Comment}
\cvitemwithcomment{Language 3}{Skill level}{Comment}

\section{Computer skills}
\cvdoubleitem{category 1}{XXX, YYY, ZZZ}{category 4}{XXX, YYY, ZZZ}
\cvdoubleitem{category 2}{XXX, YYY, ZZZ}{category 5}{XXX, YYY, ZZZ}
\cvdoubleitem{category 3}{XXX, YYY, ZZZ}{category 6}{XXX, YYY, ZZZ}

\section{Interests}
\cvitem{hobby 1}{Description}
\cvitem{hobby 2}{Description}
\cvitem{hobby 3}{Description}

%=======================================================================
% moderncv sets the \cventry as an unbreakable block - a tabular - to achieve the display alignment. Also, the seventh argument #7 of \cventry - your itemized list - is set inside a minipage which also doesn't allow for breaking across the page boundary.
%
%You can manually format separate items to allow for page breaking by setting them inside an empty \cvitem{}:
\cvitem{}{
  \begin{itemize}
  \item Worked on camera calibration and homography for the mapping of 
        objects onto a common coordinate system for object fusion and 
        analysis in world coordinates
  \end{itemize}
}
%In order to allow for this to happen naturally would require a complete rewrite of that part (which is substantial).
% ======================================================================

\section{Extra 1}
\cvlistitem{Item 1}
\cvlistitem{Item 2}
\cvlistitem{Item 3. This item is particularly long and therefore normally spans over several lines. Did you notice the indentation when the line wraps?}

\section{Extra 2}
\cvlistdoubleitem{Item 1}{Item 4}
\cvlistdoubleitem{Item 2}{Item 5}%\cite{book1}}
\cvlistdoubleitem{Item 3}{Item 6. Like item 3 in the single column list before, this item is particularly long to wrap over several lines.}

\section{References}
\begin{cvcolumns}
  \cvcolumn{Category 1}{\begin{itemize}\item Person 1\item Person 2\item Person 3\end{itemize}}
  \cvcolumn{Category 2}{Amongst others:\begin{itemize}\item Person 1, and\item Person 2\end{itemize}(more upon request)}
  \cvcolumn[0.5]{All the rest \& some more}{\textit{That} person, and \textbf{those} also (all available upon request).}
\end{cvcolumns}

\clearpage % to get bibliography to next page
\nocite{*}
\bibliographystyle{plain}
\bibliography{publications}

\end{document}

you get the following result:

first part of first page of mwe

EDIT:

To add and use the vanished old commands and colors you need to add the following code into your cv preamble:

\makeatletter
% Define vanished commands and colors:
\newcommand*{\firstnamefont}{\fontsize{28}{40}\sffamily\mdseries\upshape}
\newcommand*{\familynamefont}{\firstnamefont}
\newcommand*{\firstnamestyle}[1]{{\firstnamefont\color{firstnamecolor}#1}}
\newcommand*{\familynamestyle}[1]{{\familynamefont\color{familynamecolor}#1}}

\definecolor{firstnamecolor}{rgb}{255,0,0}% firstname color
\definecolor{familynamecolor}{rgb}{0,0,255}% familyname color

\definecolor{sectionrectanglecolor}{rgb}{0,255,0}% section rectangle color

%add old styling possibilities to current class
\patchcmd{\makecvhead}%
  {%search
    {\color{color2!50}\@firstname} {\color{color2}\@lastname}%
  }%
  {%replace
    \firstnamestyle{\@firstname} \familynamestyle{\@lastname}%% <===================
  }%
  {}%success
  {error}%failure

%New color for section rectangle
\RenewDocumentCommand{\section}{sm}{%
  \par\addvspace{2.5ex}%
  \phantomsection{}% reset the anchor for hyperrefs
  \addcontentsline{toc}{section}{#2}%
  \cvitem[0ex]{\strut\raggedleft\raisebox{\baseletterheight}{\color{sectionrectanglecolor}\rule{\hintscolumnwidth}{0.95ex}}}{\strut\sectionstyle{#2}}% <== new color sectionrectanglecolor
  \par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
\makeatother

It defines the needed colors (please change my example colors red, blue and green to your needs), the vanished commands and patches the class to be able to use the new informations.

With the complete MWE

\documentclass[11pt,a4paper,sans]{moderncv}

% moderncv themes
\moderncvstyle{casual}
\moderncvcolor{blue}
\nopagenumbers{}

\usepackage[utf8]{inputenc}

\usepackage[scale=0.75]{geometry}

\makeatletter
% Define vanished commands and colors:
\newcommand*{\firstnamefont}{\fontsize{28}{40}\sffamily\mdseries\upshape}
\newcommand*{\familynamefont}{\firstnamefont}
\newcommand*{\firstnamestyle}[1]{{\firstnamefont\color{firstnamecolor}#1}}
\newcommand*{\familynamestyle}[1]{{\familynamefont\color{familynamecolor}#1}}

\definecolor{firstnamecolor}{rgb}{255,0,0}% firstname color
\definecolor{familynamecolor}{rgb}{0,0,255}% familyname color

\definecolor{sectionrectanglecolor}{rgb}{0,255,0}% section rectangle color

%add old styling possibilities to current class
\patchcmd{\makecvhead}%
  {%search
    {\color{color2!50}\@firstname} {\color{color2}\@lastname}%
  }%
  {%replace
    \firstnamestyle{\@firstname} \familynamestyle{\@lastname}%% <===================
  }%
  {}%success
  {error}%failure

%New color for section rectangle
\RenewDocumentCommand{\section}{sm}{%
  \par\addvspace{2.5ex}%
  \phantomsection{}% reset the anchor for hyperrefs
  \addcontentsline{toc}{section}{#2}%
  \cvitem[0ex]{\strut\raggedleft\raisebox{\baseletterheight}{\color{sectionrectanglecolor}\rule{\hintscolumnwidth}{0.95ex}}}{\strut\sectionstyle{#2}}% <== new color sectionrectanglecolor
  \par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
\makeatother

% personal data
\name{John}{Doe}
\title{Resumé title}
\address{street and number}{postcode city}{country}
\phone[mobile]{+1~(234)~567~890}
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{john@doe.org}
\homepage{www.johndoe.com}
\social[linkedin]{john.doe}
\social[twitter]{jdoe}
\social[github]{jdoe}
\extrainfo{additional information}
\photo[64pt][0.4pt]{example-image-a} % -10x16
\quote{Some quote}

\setlength{\footskip}{70pt} % depends on number of infos in footer, comment and check log file


\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\section{Master thesis}
\cvitem{title}{\emph{Title}}
\cvitem{supervisors}{Supervisors}
\cvitem{description}{Short thesis abstract}

\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines.\newline{}%
Detailed achievements:%
\begin{itemize}%
\item Achievement 1;
\item Achievement 2, with sub-achievements:
  \begin{itemize}%
  \item Sub-achievement (a);
  \item Sub-achievement (b), with sub-sub-achievements (don't do this!);
    \begin{itemize}
    \item Sub-sub-achievement i;
    \item Sub-sub-achievement ii;
    \item Sub-sub-achievement iii;
    \end{itemize}
  \item Sub-achievement (c);
  \end{itemize}
\item Achievement 3.
\end{itemize}}
\cventry{year--year}{Job title}{Employer}{City}{}{Description line 1\newline{}Description line 2}

\end{document}

you get the wished result:

resulting pdf for mwe two

  • That is what I already had found.I am more interested in the missing color definitions. – Matthias Pospiech Sep 29 '15 at 7:20
  • @MatthiasPospiech Please see the updated answer .... – Mensch Aug 16 at 2:18

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.