1

I have the following problem on the moderncv-class: enter image description here

As you can see all personal information is perfect to an imaginary line to the right except for "city" which obviously is somewhat to the left. Of course I'd like to have all lines ending at the perfectly at the imaginary line at the right.

Further, I'd like to have more modern symbols for the mobile, mail etc. I know that there is a way to change them, but unfortunately I don't know how...

Here I have a MWE:

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

\moderncvtheme[black]{banking}



\usepackage[english]{babel}

\usepackage{blindtext}

\makeatletter


\newcommand*{\birthdate}[1]{\def\@birthdate{#1}}
\newcommand*{\civilstatus}[1]{\def\@civilstatus{#1}}

\renewcommand*{\namefont}{\fontsize{34}{36}\mdseries\upshape}
\renewcommand*{\titlefont}{\LARGE\mdseries\slshape}
\renewcommand*{\addressfont}{\small\mdseries\slshape}
\renewcommand*{\quotefont}{\large\slshape}
\renewcommand*{\sectionfont}{\Large\mdseries\upshape}
\renewcommand*{\subsectionfont}{\large\mdseries\upshape}
\renewcommand*{\hintfont}{}

% styles
\renewcommand*{\namestyle}[1]{{\namefont\textcolor{color0}{#1}}}
\renewcommand*{\titlestyle}[1]{{\titlefont\textcolor{color2!60}{#1}}}
\renewcommand*{\addressstyle}[1]{{\addressfont\textcolor{color1}{#1}}}
\renewcommand*{\quotestyle}[1]{{\quotefont\textcolor{color1}{#1}}}
\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{#1}}}
\renewcommand*{\subsectionstyle}[1]{{\subsectionfont\textcolor{color1}{#1}}}
\renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}
%
\newlength{\makecvtitlenamewidth}
\setlength{\makecvtitlenamewidth}{0pt}% dummy value
\renewcommand*{\makecvtitle}{%
  % recompute lengths (in case we are switching from letter to resume, or vice versa)
  \recomputecvlengths%
  \def\socialsdetails{}%
  \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
    \protected@edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
  % optional detailed information box
  \newbox{\makecvtitledetailsbox}%
  \savebox{\makecvtitledetailsbox}{%
    \addressfont\color{color2}%
    \begin{tabular}[b]{@{}r@{}}%
    \ifthenelse{\isundefined{\@birthdate}}{}{\makenewline{\@birthdate}}%
    \ifthenelse{\isundefined{\@civilstatus}}{}{\makenewline{\@civilstatus}}%
      \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
        \ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}
        \ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}% if \addresstreet is defined, \addresscity will always be defined but could be empty
      \ifthenelse{\isundefined{\@mobile}}{}{\makenewline\mobilesymbol\@mobile}%
      %\ifthenelse{\isundefined{\@phone}}{}{\makenewline\phonesymbol\@phone}%
      %\ifthenelse{\isundefined{\@fax}}{}{\makenewline\faxsymbol\@fax}%
      \ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
      \ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
      \socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
      \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
    \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=64pt]{whatever}}}}%
  % 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-\makecvtitledetailswidth-\makecvtitlepicturewidth}}%
    {}%
  \begin{minipage}[b]{\makecvtitlenamewidth}%
    \namestyle{\@firstname\ \@familyname}%
    \ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
  \end{minipage}%
  \hfill%
  % detailed information
  \llap{\usebox{\makecvtitledetailsbox}}% \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
    % personal data
    \firstname{Name}
    \familyname{Surname}
    \title{Master of Science}                                                                                                      
    \birthdate{Birthday}
    \civilstatus{XXX}
    \address{Street}{City}{Country}
    \mobile{Mobile}                                                                         
    %\phone{}   
    %\fax{}    
    \email{Mail}                                                                                 
    \social[linkedin]{linkedin}
    %\homepage{}                                                                                           
    %\extrainfo{\linkedinsocialsymbol~poksche}
    \photo[64pt][0.4pt]{picture}
    \begin{document}
    \makecvtitle
    \section{Education}
    \cventry{Grade}{Course}{University}{2014}{M.Sc.}{}
    \end{document}

Many thanks in advance.

  • 1
    just looking there's clearly a % missing from ` \ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}` – David Carlisle Oct 30 '14 at 19:36
  • @DavidCarlisle oh boy, that was too easy... thank you very much. First problem solved. What about the second point? Do you have an idea about changing the icons for mobile, mail etc.? – Phil Oct 30 '14 at 19:48
  • search suggests tex.stackexchange.com/questions/96557/… (which i apparently answered:-) – David Carlisle Oct 30 '14 at 19:50
  • @DavidCarlisle I'm not sure if this post will help me out since I'd like to have more modern icons. right now I'm coming up with exactly those icons as in the other post. I've already seen more modern icons such as a smartphone-icon for your mobile number. however, I don't know how to reproduce them. maybe I missed a point in the other post, but it doesn't seem to tackle the problem of the "modernness" of icons, does it? – Phil Oct 30 '14 at 19:57
  • ive never used the class but search suggests it has commands to switch icon sets eg: tex.stackexchange.com/questions/110342/… – David Carlisle Oct 30 '14 at 20:00
2

As @DavidCarlisle said in his comment the error is a missing %. I added it in the following MWE (see line with <=============).

As you can see I was able to compile with XeLaTeX your given MWE with an added \moderncvicons{awesome} to use other symbols with no error message or warning. See screenshot below.

MWE:

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

\moderncvtheme[black]{banking}



\usepackage[english]{babel}

\usepackage{blindtext}

\moderncvicons{awesome} %  awesome, marvosym or letters 

\makeatletter


\newcommand*{\birthdate}[1]{\def\@birthdate{#1}}
\newcommand*{\civilstatus}[1]{\def\@civilstatus{#1}}

\renewcommand*{\namefont}{\fontsize{34}{36}\mdseries\upshape}
\renewcommand*{\titlefont}{\LARGE\mdseries\slshape}
\renewcommand*{\addressfont}{\small\mdseries\slshape}
\renewcommand*{\quotefont}{\large\slshape}
\renewcommand*{\sectionfont}{\Large\mdseries\upshape}
\renewcommand*{\subsectionfont}{\large\mdseries\upshape}
\renewcommand*{\hintfont}{}

% styles
\renewcommand*{\namestyle}[1]{{\namefont\textcolor{color0}{#1}}}
\renewcommand*{\titlestyle}[1]{{\titlefont\textcolor{color2!60}{#1}}}
\renewcommand*{\addressstyle}[1]{{\addressfont\textcolor{color1}{#1}}}
\renewcommand*{\quotestyle}[1]{{\quotefont\textcolor{color1}{#1}}}
\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{#1}}}
\renewcommand*{\subsectionstyle}[1]{{\subsectionfont\textcolor{color1}{#1}}}
\renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}
%
\newlength{\makecvtitlenamewidth}
\setlength{\makecvtitlenamewidth}{0pt}% dummy value
\renewcommand*{\makecvtitle}{%
  % recompute lengths (in case we are switching from letter to resume, or vice versa)
  \recomputecvlengths%
  \def\socialsdetails{}%
  \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
    \protected@edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
  % optional detailed information box
  \newbox{\makecvtitledetailsbox}%
  \savebox{\makecvtitledetailsbox}{%
    \addressfont\color{color2}%
    \begin{tabular}[b]{@{}r@{}}%
    \ifthenelse{\isundefined{\@birthdate}}{}{\makenewline{\@birthdate}}%
    \ifthenelse{\isundefined{\@civilstatus}}{}{\makenewline{\@civilstatus}}%
      \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
        \ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}%  %<===============================
        \ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}% if \addresstreet is defined, \addresscity will always be defined but could be empty
      \ifthenelse{\isundefined{\@mobile}}{}{\makenewline\mobilesymbol\@mobile}%
      %\ifthenelse{\isundefined{\@phone}}{}{\makenewline\phonesymbol\@phone}%
      %\ifthenelse{\isundefined{\@fax}}{}{\makenewline\faxsymbol\@fax}%
      \ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
      \ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
      \socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
      \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
    \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=64pt]{whatever}}}}%
  % 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-\makecvtitledetailswidth-\makecvtitlepicturewidth}}%
    {}%
  \begin{minipage}[b]{\makecvtitlenamewidth}%
    \namestyle{\@firstname\ \@familyname}%
    \ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
  \end{minipage}%
  \hfill%
  % detailed information
  \llap{\usebox{\makecvtitledetailsbox}}% \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
    % personal data
    \firstname{Name}
    \familyname{Surname}
    \title{Master of Science}                                                                                                      
    \birthdate{Birthday}
    \civilstatus{XXX}
    \address{Street}{City}{Country}
    \mobile{Mobile}                                                                         
    %\phone{}   
    %\fax{}    
    \email{Mail}                                                                                 
    \social[linkedin]{linkedin}
    %\homepage{}                                                                                           
    %\extrainfo{\linkedinsocialsymbol~poksche}
    \photo[64pt][0.4pt]{picture}


\begin{document}
\makecvtitle
\section{Education}
\cventry{Grade}{Course}{University}{2014}{M.Sc.}{}
\end{document}

Screenshot:

enter image description here

If you can't compile my MWE without errors you have a problem with your system. Then it is important to know the error messages from the log file. But I think the better place to discuss this problem is the other question ...

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.