3

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?

  • 4
    I get a different error, but the key here is that moderncv requires you to set up things in the preamble, which you have not done. Try \documentclass{moderncv} \moderncvstyle{classic} \moderncvcolor{green} \firstname{John} \familyname{Doe} \title{Curriculum Vitae} \begin{document} \maketitle Hello. \end{document} – Steven B. Segletes Aug 30 '17 at 13:26
2

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

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.