6

I have been using moderncv to generate some cover letters and CVs recently. Everything was working fine, until I have done a Miktex update. I keep getting the error Undefined control sequence. \makelettertitle for the following MWE (Which used to worjk without any problems!):

\documentclass[12pt,a4paper,sans]{moderncv} 
\moderncvstyle{classic} 
\moderncvcolor{blue} 
\usepackage{lipsum} 

\usepackage[scale=0.82]{geometry} \geometry{textheight=25cm}
\usepackage[ngerman]{babel}
\usepackage{blindtext}
\usepackage{ragged2e}
\usepackage{pdfpages}
%%%%%%%%%%%%%%%%%%%

\makeatletter

\renewcommand*{\makelettertitle}{%
  % recompute lengths (in case we are switching from letter to resume, or vice versa)
  \recomputeletterlengths%
  % sender contact info
  %\hfill%
  \begin{minipage}{.5\textwidth}%
    \raggedright% \raggedleft
    \addressfont\textcolor{color2}{%
      \makebox[\textwidth][l]{\makebox[2\textwidth]{\bfseries\upshape\@firstname~\@lastname\hfill\normalfont\textcolor{black}{\@date}}}\@firstdetailselementfalse%
      \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
        \ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty
        \ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
      \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
        \makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}%
      \ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
      \ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
      \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}}%
    \end{minipage}\\[3em]
  % recipient block
  \begin{minipage}[t]{.5\textwidth}
    \raggedright%
    \addressfont%
    {\@recipientname}\\%
    \@recipientaddress%
  \end{minipage} \\[2em]
  % date
  %\hfill% US style
%  \\[1em]% UK style
  %\@date\\[2em]% US informal style: "January 1, 1900"; UK formal style: "01/01/1900"
  % opening
  \raggedright%
  \@opening\\[1.5em]%
  % ensure no extra spacing after \makelettertitle due to a possible blank line
%  \ignorespacesafterend% not working
  \hspace{0pt}\par\vspace{-\baselineskip}\vspace{-\parskip}} 

\setlength{\makecvtitlenamewidth}{12cm}
\renewcommand*{\namefont}{\fontsize{24}{29}\mdseries\upshape}

\makeatother

%\patchcmd{\makeletterclosing}{[2em]}{[1em]}{}{}
\firstname{XXXXXX} % Your first name
\familyname{XXXXXX} 
\title{CV}
\address{XXXXXX,12}{12345,XXXXXX}
\email{XXXXXXXXXXXXXX@XXXX.XXX}
\begin{document}
\recipient{XXXX}{XXXX\\XXXXXXXXXXXX\\1234 XXXXXX\\XXXXXX} 
\date{\today} % Letter date
\opening{blablabla,} % Opening greeting
\closing{blablabla} % Closing phrase
\enclosure[Im Anhang]{CV} % List of enclosed documents

\makelettertitle % Print letter title
\blindtext[3]
\makeletterclosing % Print letter signature
\clearpage

%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Lebenslauf
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\clearpage

\makecvtitle % Print the CV title

\section{EDV- Kenntnisse}

\cvitem{Tool}{C, C++, VHDL}
\cvitem{Betriebssystem}{Unix, Windows}
\cvitem{Simulations-Tools}{Tool, Tool, Tool II, Tool}

%---------------------------------

\end{document}

Any help is appreciated.

Update: Following the log file, the errors are the following:

  • Undefined control sequence. \setlength{\makecvtitlenamewidth}{12cm}
  • Missing number, treated as zero. \renewcommand
  • Illegal unit of measure (pt inserted). \renewcommand

Which are respectively originating from the two commands:

 \setlength{\makecvtitlenamewidth}{12cm}
\renewcommand*{\namefont}{\fontsize{24}{29}\mdseries\upshape}
  • Try to change \renewcommand to \newcommand. – Sigur Aug 30 '15 at 20:09
  • Check if you have a local copy of moderncv or some of its components in your working folder. – Werner Aug 30 '15 at 20:29
  • @Werner. I just removed all local copies, but Still the problem is persisting – user2536125 Aug 30 '15 at 20:44
  • @Sigur, I just found out the problem is coming from the line '\setlength{\makecvtitlenamewidth}{12cm}' but i still can't solve it – user2536125 Aug 30 '15 at 20:45
  • 1
    The length is not defined. \newlength{\makecvtitlenamewidth} – Johannes_B Aug 31 '15 at 5:53
9

\makecvtitlenamewidth existed as part of moderncv 1.5.0, but was removed from moderncv 1.5.1 - the current latest version.

The current replacement seems to be \makecvheadnamewidth, which a default of 0pt (used in conditioning for an automatically set width).

The class has undergone numerous changes which makes older versions of documents incompatible with current versions. If you wish to keep the older formats, you need to maintain a temporary version of the class. Otherwise, you'll have to update your documents accordingly.

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.