[Tex/LaTex] moderncv banking style: add a extra line above the address information

moderncvtitles

I would like to add a extra information, but before the address information line, and after my name, of course.

How can I do that?

Best Answer

The following minimal example patches \maketitle to insert a macro that contains "extra information" in the title for the moderncv banking style. The command used to adjust this "extra information" is \someextrainfo{<stuff>}. You can also adjust the font, if needed, using \someextrainfofont{<font>}. Note that you may have to reset any such font changes using \addressfont{<font>}, as fonts are set using switches.

enter image description here

\documentclass{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\maketitle}% <cmd>
  {\addressfont\color{color2}}% <search>
  {\@someextrainfofont\color{color2}%
   \ifcsdef{@someextrainfo}{\@someextrainfo\\}{}%
   \addressfont}% <replace>
  {}{}% <success><failure>
\providecommand{\@someextrainfofont}{}
\newcommand{\someextrainfo}[1]{\gdef\@someextrainfo{#1}}
\newcommand{\someextrainfofont}[1]{\gdef\@someextrainfofont{#1}}
\makeatother

\usepackage{libertine}
\usepackage[scale=0.75]{geometry}

\name{John}{Doe}
\someextrainfo{some extra information}
\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}
\homepage{www.johndoe.com}
\quote{Some quote}

\begin{document}
\makecvtitle

\section{A test section}
Some test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text

\end{document}