This question relates to another one asked here a few years ago. The goal back then was to set the contact details below the name in a classic cv made with moderncv
.
I simply tried to copy the code:
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\makeatletter
\renewcommand*{\makecvtitle}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
\recomputecvlengths%
% optional detailed information box
\newbox{\makecvtitledetailsbox}%
\savebox{\makecvtitledetailsbox}{%
\addressfont\color{color2}%
\begin{tabular}[b]{@{}p{10cm}@{}}%
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet %
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}} % if \addresstreet is defined, \addresscity will always be defined but could be empty
\ifthenelse{\isundefined{\@mobile}}{}{\makenewline\mobilesymbol\@mobile} %
\ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
\end{tabular}
}%
% optional photo (pre-rendering)
\newbox{\makecvtitlepicturebox}%
\savebox{\makecvtitlepicturebox}{%
\ifthenelse{\isundefined{\@photo}}%
{}%
{%
% \hspace*{\separatorcolumnwidth}%
\color{color1}%
\setlength{\fboxrule}{\@photoframewidth}%
\ifdim\@photoframewidth=0pt%
\setlength{\fboxsep}{0pt}\fi%
\framebox{\includegraphics[width=\@photowidth]{\@photo}}}}%
% name and title
\newlength{\makecvtitledetailswidth}\settowidth{\makecvtitledetailswidth}{\usebox{\makecvtitledetailsbox}}%
\newlength{\makecvtitlepicturewidth}\settowidth{\makecvtitlepicturewidth}{\usebox{\makecvtitlepicturebox}}%
\ifthenelse{\lengthtest{\makecvtitlenamewidth=0pt}}% check for dummy value (equivalent to \ifdim\makecvtitlenamewidth=0pt)
{\setlength{\makecvtitlenamewidth}{\textwidth-\makecvtitlepicturewidth
}}%
{}%
% \begin{minipage}[b]{\makecvtitlenamewidth}%
\raggedright\namestyle{\@firstname\ \@familyname}\par\medskip%
\ifthenelse{\equal{\@title}{}}{}{{\centering\titlestyle{\@title}\par}\medskip}%
%\hfill%
% detailed information
% \llap{
%
\usebox{\makecvtitledetailsbox}%
%\end{minipage}\ignorespaces%
%}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvtitlenamewidth is forced
% optional photo (rendering)
\usebox{\makecvtitlepicturebox}\\[2.5em]%
% optional quote
\ifthenelse{\isundefined{\@quote}}%
{}%
{{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
\par}% to avoid weird spacing bug at the first section if no blank line is left after \makecvtitle
\makeatother
\usepackage[scale=0.75]{geometry}
% personal data
\name{John}{Doe}
\address{street and number}{postcode city}{country}
\phone[mobile]{+1~(234)~567~890}
\email{john@doe.org}
\photo[64pt][0.4pt]{C:/Users/wwa594/Documents/Downloads/pictures/picture}
\begin{document}
\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\end{document}
However, I receive a couple of errors starting with a !Undefined control sequenec error
. The errors are gone once I comment out the renewcommand function.
Here is a snippet from the log
file which does not help me a lot:
! Undefined control sequence. \makecvtitlenamewidth
=0pt l.66 \makecvtitle
The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g.,
\hobx'), type
I' and the correct spelling (e.g., `I\hbox').
Otherwise just continue, and I'll forget about whatever was undefined.! Missing number, treated as zero.
= l.66 \makecvtitle
A number should have been here; I inserted0'. (If you can't figure out why I needed to see a number, look up
weird
error' in the index to The TeXbook.)! Illegal unit of measure (pt inserted).
= l.66 \makecvtitle
Dimensions can be in units of em, ex, in, pt, pc, cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one! I'll assume
that you meant to say pt, for printer's points. To recover gracefully
from this error, it's best to delete the erroneous units; e.g., type
`2' to delete two letters. (See Chapter 27 of The TeXbook.)! Undefined control sequence. \makecvtitlenamewidth
l.66 \makecvtitle
The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g.,
\hobx'), type
I' and the correct spelling (e.g., `I\hbox').
Otherwise just continue, and I'll forget about whatever was undefined.! Missing number, treated as zero.
\let l.66 \makecvtitle
A number should have been here; I inserted0'. (If you can't figure out why I needed to see a number, look up
weird
error' in the index to The TeXbook.)! Illegal unit of measure (pt inserted).
\let l.66 \makecvtitle
Could you help me please to make this example compilable?
Best Answer
In an earlier version used variable
\makecvtitlenamewidth
has been renamed to\makecvheadnamewidth
in the current version ofmoderncv
, version 2.0.0.So you have to change the variable name in your code. See the following MWE (changes marked with
<==============
):and the result: