Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I like the moderncv casual theme, but I would like to change the order of the photo and the name / title. I tried the solution described in this question: Modify moderncv header

! Undefined control sequence.
\maketitle ->{{\firstnamestyle 
                               {\@firstname}~\familynamestyle {\@familyname}...
l.33 \maketitle

Example code:

\documentclass[11pt,a4paper]{moderncv}

% moderncv themes
\moderncvtheme[blue]{casual}
\AtBeginDocument
{
% reverse the name and photo
\makeatletter
% maketitle
\renewcommand*{\maketitle}{%
  {%
    {\firstnamestyle{\@firstname}~\familynamestyle{\@familyname}}}%
    \hfill%
    \ifthenelse{\isundefined{\@photo}}%
      {}%
      {{\color{firstnamecolor}\framebox{\includegraphics[width=\@photowidth]{\@photo}}}\\[-.35em]}%
    {\color{firstnamecolor}\rule{\textwidth}{.25ex}\\[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 \maketitle
\makeatother
}

\firstname{John}
\familyname{Doe}
\title{Curriculum Vitae}    
\address{Example Street}{12345 Exampe Town}
\photo{picture}

\begin{document}
\maketitle
\end{document}
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

One way to solve the problem, that class moderncv has changed could be the following MWE. The part after \AtBeginDocument rewrites the original definition in moderncv.

Please keep in mind: if the class moderncv is changed again, you may need to change your corrections again. Perhaps it would be a good idea to ask the author of moderncv to integrate an option to change the position of name and picture.

The changed MWE:

\documentclass[11pt,a4paper]{moderncv}

\moderncvstyle{casual}
\moderncvcolor{blue}

\firstname{John}
\familyname{Doe}
\title{Resumé title}
\address{street and number}{postcode city}
\mobile{+1~(234)~567~890}
\phone{+2~(345)~678~901}
\fax{+3~(456)~789~012}
\email{john@doe.org}
\homepage{www.johndoe.com}
\extrainfo{additional information}
\photo[64pt][0.4pt]{picture}
\quote{Some quote}

\makeatletter
%\AtBeginDocument
%{
% reverse the name and photo
\renewcommand*{\makecvtitle}{%
  \recomputecvlengths%
  \makecvfooter%
  % define optional picture
  \newbox{\makecvtitlepicturebox}%
  \savebox{\makecvtitlepicturebox}{%
    \ifthenelse{\isundefined{\@photo}}%
      {
        \@initializelength{\makecvtitlepicturewidth}% Damit Länge bekannt bei Name
        \settowidth{\makecvtitlepicturewidth}{0pt}%
      }%
      {%
       \setlength\fboxrule{\@photoframewidth}%
       \ifdim\@photoframewidth=0pt%
         \setlength{\fboxsep}{0pt}\fi%
       {\color{color1}\framebox{\includegraphics[width=\@photowidth]{\@photo}}}}
        \@initializelength{\makecvtitlepicturewidth}% Damit Länge bekannt bei Name
        \settowidth{\makecvtitlepicturewidth}{\usebox{\makecvtitlepicturebox}}%
      }%
  % end define optional picture

  % name
%    \parbox[b]{\textwidth-\makecvtitlepicturewidth}{%
 {   \raggedright\namefont{\color{color2!50}\@firstname} {\color{color2}\@familyname}}%\lastname -> error
    \hfill\usebox{\makecvtitlepicturebox}%
%    \parbox[b]{\textwidth-\makecvtitlepicturewidth}{%
%   \raggedleft\namefont{\color{color2!50}\@firstname} {\color{color2}\@lastname}}%\familyname
\\[-.35em]%
  {\color{color2!50}\rule{\textwidth}{.25ex}}%
  % optional title
  \ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\null\hfill\titlestyle{\@title}}\\[2.5em]% 
  % optional quote
  \ifthenelse{\isundefined{\@quote}}%
    {}%
    {{\null\hfill\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\hfill\null\\[2.5em]}}%
  \par}% 
%}% AtBeginDocument ende
\makeatother


\begin{document}
\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{ \textit{Grade} }{Description}  % arguments 3 to 6 can be left empty
\cvitem{title}{ \emph{Title} }
\cvitemwithcomment{Language 1}{Skill level}{Comment}
\cvdoubleitem{category X}{XXX, YYY, ZZZ}{category Y}{XXX, YYY, ZZZ}
\cvlistitem{Item 1}
\cvlistdoubleitem{Item 2}{Item 3}
\end{document}

The result is: Result of MWE

share|improve this answer
    
Great! As you said I suggested the author to implement such a feature. –  user27125 Apr 3 '13 at 6:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.