[Tex/LaTex] “Undefined control sequence” at beginning of document with moderncv

document-classeserrorsmoderncv

I'm trying to use moderncv. When I try to compile the following document

\documentclass{moderncv}
\begin{document}
Hello.
\end{document}

I get 8 times the error:

Undefined control sequence. \begin{document}

When I use any other documentclass, such as article or report everything works. I'm using texlive with texstudio on ubuntu and I compiled with PdfLaTeX.

Can anybody help me with this issue?

Best Answer

Well, class moderncv is different to the usual one class article etc.

Because it is supposed to typeset a curriculum vitae, there are more information needed than in an "usual" class.

Because a cv needs a name of the person the cv is for you have to add the information

\name{John}{Doe}

Now you can compile your MWE with an added \name{John}{Doe} without errors but not with the layout of a cv:

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

% personal data
\name{John}{Doe}


\begin{document}

Hello.

\end{document}

and the result:

enter image description here

That has compiled without errors, but is far away from a cv ...

To get a real cv you have to add more informations, for example the style of the layout. Then you need to add informations about education etc. Class moderncv provides special commands for that.

The absolut minimal code for an cv with moderncv is the following MWE:

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

% moderncv themes
 \moderncvstyle{classic} % 'casual' (default), 'classic', 'banking', 'oldstyle' and 'fancy'
 \moderncvcolor{blue}    % 'black' (default)

% character encoding
\usepackage[utf8]{inputenc}

% adjust the page margins
\usepackage[scale=0.75]{geometry}

% 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}


\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description} 

Hello.  % <========= to be deleted!

\end{document}


%% end of file `template.tex'.

I used the original template.tex file (an cv example) from moderncv and minimalized it. As you can see in the compiled following MWE, your input "Hello." makes no sense now ...

The result you get is:

resulting cv