[Tex/LaTex] Moderncv – undefined control sequence in minimal document

moderncvundefined

Attempting to compile the following minimal working example fails on my TeX installation.

\documentclass{moderncv}
%\moderncvstyle{banking}

\begin{document}
    Foo
\end{document}

The log file repeats the following error eight times:

! Undefined control sequence.
<argument> \@firstname 
            {}~\@lastname {}
l.6 \begin{document}

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.

The error remains the same whether I'm using pdflatex or luatex to compile. I'm using a fresh (full) TeX Live 2016 installation and tlmgr revision 41476 in Linux Mint and I'm using TeXstudio as my editor. According to tlmgr update --all and tlmgr update --self my installation is up to date.

Uncommenting the style statement results in an additional warning:

LaTeX Warning: You have requested package `moderncvheadiii',
               but the package provides `moderncvheadiii'.

I found a few mentions of this online, but it seems this issue was fixed by a moderncv update (https://github.com/xdanaux/moderncv/issues/1).

Peculiarly, I can update and re-compile an older moderncv document (that was made on another distribution) without any issues. Other document classes also seem to work correctly.

How would I go about troubleshooting an issue like this?

EDIT

Thank you @Elad Den for pointing out that I need to define names in the document's preamble. Both \name{}{} and \firstname{} \familyname{} work, although my editor does not recognise the former command. This does indeed allow me to compile without any issues.

Unfortunately it wasn't smooth sailing from here on out. Adding \recipients{}, \opening{}, \closing{} and \makeletterclosing work fine, but adding \makelettertitle results in the following errors:

Undefined control sequence. \makelettertitle
You have requested package `moderncvheadiii', but the package provides `moderncvheadiii'.
You have requested package `moderncvbodyiii', but the package provides `moderncvbodyiii'.

Remarkably, I do receive a (seemingly) correct pdf output, despite the mess of errors and warnings in my log file.

I've found one reference to a similar issue, but no solutions were offered in this thread: Problem with moderncv or TexStudio: makelettertitle is undefined

Best Answer

It seems like (since this is a CV) the documentclass is expecting \firstname{} and \familyname{} to be defined. You could add those lines to the preamble or use the \name{}{} command

\documentclass{moderncv}
%\moderncvstyle{banking}

%\firstname{}
%\familyname{}

\name{}{}

\begin{document}
    Foo
\end{document}