2

This question already has an answer here:

I'm using moderncv and I'm having an issue adding birthdate

This is the code I'm using

\documentclass[10pt,a4paper,sans]{moderncv}
\moderncvstyle[right]{classic}
\moderncvcolor{burgundy}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.8]{geometry}
\usepackage{setspace}
\usepackage{multicol}
\setlength{\hintscolumnwidth}{2.8cm}
\renewcommand*{\namefont}{\fontsize{24}{0}\bfseries\upshape}
\firstname{\vspace{2mm}John\vspace{2mm}}
\lastname{Doe}
\dateofbirth{1987-02-13}
\address{24 Groove Street, LA, USA}
\phone[mobile]{+123456789}
\email{john.doe@gmail.com}
\photo[50pt][1pt]{photo}

\begin{document}

\makecvtitle

\end{document}

The date is displayed on top of the image, as \dateofbirth is not recognized by moderncv.

enter image description here

I want to put the birthdate excactly before the address but I don't know how.

marked as duplicate by Community Oct 30 '18 at 22:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

At last it depends on which version of moderncv you use. My example is for the current one, version 2.0.0.

The following code adds an command \dateofbirth and patches the code of the class:

\makeatletter
\newcommand*{\dateofbirth}[1]{\def\@dateofbirth{#1}}
\patchcmd{\makecvhead} % <cmd>
  {\if@right\begin{tabular}[b]{@{}l@{}}\fi} % <search>
  {\if@right\begin{tabular}[b]{@{}l@{}}\fi%
   \ifthenelse{\isundefined{\@dateofbirth}}{}{\makenewline Date of birth \@dateofbirth}%
  } % <replace>
  {}{} % <success><failure>
\makeatother
\dateofbirth{1987-02-13}

So with the following MWE

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

\moderncvstyle[right]{classic}
\moderncvcolor{burgundy}

\usepackage[utf8]{inputenc}
\usepackage[scale=0.8]{geometry}
\usepackage{setspace}
\usepackage{multicol}
\setlength{\hintscolumnwidth}{2.8cm}
\renewcommand*{\namefont}{\fontsize{24}{0}\bfseries\upshape}
\firstname{\vspace{2mm}John\vspace{2mm}}
\lastname{Doe}

\address{24 Groove Street, LA, USA}
\phone[mobile]{+123456789}
\email{john.doe@gmail.com}
\photo[50pt][1pt]{photo}

\usepackage{etoolbox}

\makeatletter
\newcommand*{\dateofbirth}[1]{\def\@dateofbirth{#1}}
\patchcmd{\makecvhead} % <cmd>
  {\if@right\begin{tabular}[b]{@{}l@{}}\fi} % <search>
  {\if@right\begin{tabular}[b]{@{}l@{}}\fi%
   \ifthenelse{\isundefined{\@dateofbirth}}{}{\makenewline Date of birth \@dateofbirth}%
  } % <replace>
  {}{} % <success><failure>
\makeatother
\dateofbirth{1987-02-13}


\begin{document}

\makecvtitle

\end{document}

you get the result:

enter image description here

After changeing the line

\ifthenelse{\isundefined{\@dateofbirth}}{}{\makenewline Date of birth \@dateofbirth}% 

in the patch to

\ifthenelse{\isundefined{\@dateofbirth}}{}{\makenewline Date of birth \textbf{\@dateofbirth}}%

I get the following result:

enter image description here

As you can see above the red line the date is printed in bold ...

  • Thanks it's working now. But what If I want to give bold effect to the birthdate ? Using textbf doesn't work – Amine Messaoudi Oct 30 '18 at 21:57
  • I changed it but it's not working – Amine Messaoudi Oct 30 '18 at 22:06
  • no the font shows bold in other parts of the document but not on the personal info like birthdate, address, phone, email... – Amine Messaoudi Oct 30 '18 at 22:15
  • I'm using overleaf and no errors or warnings are being shown. I changed the line and added textbf to dateofbirth but it won't work – Amine Messaoudi Oct 30 '18 at 22:21
  • I just solved it by adding \color{rgb(0,0,0)} before dateofbirth. Thank you for your help. – Amine Messaoudi Oct 30 '18 at 22:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.