2

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?

2
  • 1
    Welcome! Please add a Minimal Working example starting with \documentclass ... and ending with \end{document} so as people here can reproduce your situation and help you.
    – AboAmmar
    Commented Jul 13, 2015 at 20:15
  • you have \title{more informations}
    – touhami
    Commented Jul 13, 2015 at 21:04

2 Answers 2

3

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{[email protected]}
\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}
2
  • But, in this way the frase "some extra information" repeats twice, in the first line and in the end od the header.
    – user81898
    Commented Jul 13, 2015 at 21:31
  • @user81898: The macro \extrainfo already existed, sorry. I've updated that to use \somextrainfo (and \somextrainfofont).
    – Werner
    Commented Jul 13, 2015 at 21:51
1

Finally, I edit Wener's code. Just to make a difference between the default extrainfo and this new extrainfo

The following minimal example patches `\maketitle` to insert a macro that contains "extra information" in the title for the [`moderncv`](http://ctan.org/pkg/moderncv) `banking` style. The command used to adjust this "extra information" is `\extrainfo{<stuff>}`. You can also adjust the font, if needed, using `\extrainfofont{<font>}`. Note that you may have to reset any such font changes using `\addressfont{<font>}`, as fonts are set using *switches*.


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

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

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

\name{John}{Doe}
\extrainf{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{[email protected]}
\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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .