2

This is a follow-up question to Banking style of moderncv doesnt reconize `\makecvheadnamewidth` for fiting long names and to How to mix/combine moderncv styles?.

Now I am looking to add the definition of the command \photo to the banking style I already read ModernCV Banking photo title and this How to include picture in banking style with exactly position but since I have mixed styles things got confused I don't know how to make it to work.

  • I want my photo besides the title not above it,
  • a plus would be to choose whether to put it on the left or on the right of the header.

enter image description here

MWE:

\documentclass{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\moderncvhead{3}

\usepackage[scale=0.85]{geometry}
\usepackage{xpatch}

\makeatletter  %to fix the issue of the long name in banking style
\xpatchcmd{\makehead}{%
\titlestyle{~|~\@title}%
}{%
\\\vspace*{10pt}\titlestyle{\@title}\vspace*{10pt}%
}{}{false}
\makeatother

\makeatletter
\let\oldmakecvtitle\makecvtitle
\renewcommand*{\makecvtitle}{%
  {\framebox{\includegraphics[width=\@photowidth]{\@photo}}\par\vspace{10pt}}%
  \oldmakecvtitle%
}%
\makeatother

%%%%%%%%%%%%%%%%
\nopagenumbers{}
\title{Curriculum Vitae}
\firstname{my long name}
\familyname{familyname}
\address{address comes here}{10000}
\phone[mobile]{00~00~00~00~00}
\email{[email protected]}
\extrainfo{xx ans Permis B}
\photo[64pt][40pt]{example-image.png}
\begin{document}
\makecvtitle
\end{document}
0

1 Answer 1

2

You need to have a look into the sources of class moderncv. Then you can find, that the code of header for style classic differes to the code of header for banking. In your case you need to change the code of header for banking.

That is the reason you have to use:

\patchcmd{\makehead}
  {\setlength{\makeheaddetailswidth}{0.8\textwidth}}
  {\setlength{\makeheaddetailswidth}{0.67\textwidth}}
  {}
  {false2}
\patchcmd{\makehead}% version 2.0.0, style banking, head3
  {\\[2.5em]}
  {\hfil\raisebox{-1.6cm}{\framebox{\includegraphics[width=\@photowidth]{\@photo}}}\\[2.5em]}
  {}
  {failure} 

instead the changing with

\let\oldmakecvtitle\makecvtitle
\renewcommand*{\makecvtitle}{%
  {\framebox{\includegraphics[width=\@photowidth]{\@photo}}\par\vspace{10pt}}%
  \oldmakecvtitle%
}%

you tried.

Depending on the used image you have to change the value in command \raisebox to your needs.

With the following complete MWE

\documentclass{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\moderncvhead{3} % uses header from style banking!

\usepackage[scale=0.85]{geometry}
\usepackage{xpatch}

\makeatletter  %to fix the issue of the long name in banking style
\patchcmd{\makehead}{%
\titlestyle{~|~\@title}%
}{%
\\\vspace*{10pt}\titlestyle{\@title}\vspace*{10pt}%
}{}{false}

\patchcmd{\makehead}
  {\setlength{\makeheaddetailswidth}{0.8\textwidth}}
  {\setlength{\makeheaddetailswidth}{0.67\textwidth}}
  {}
  {false2}
\patchcmd{\makehead}% version 2.0.0, style banking, head3
  {\\[2.5em]}
  {\hfil\raisebox{-1.6cm}{\framebox{\includegraphics[width=\@photowidth]{\@photo}}}\\[2.5em]}
  {}
  {failure}
\makeatother

%%%%%%%%%%%%%%%%
\nopagenumbers{}
\title{Curriculum Vitae}
\firstname{my long name}
\familyname{familyname}
\address{address comes here}{10000}
\phone[mobile]{00~00~00~00~00}
\email{[email protected]}
\extrainfo{xx ans Permis B}
\photo[64pt][40pt]{example-image-10x16} % --> change \raisebox{-1.6cm}{} to your needs ...
\begin{document}
\makecvtitle
\end{document}

you get the photo on the right side on the paper, see the following result:

result photo right

To get the photo to the left needs to rebuild the header completely using a tabular environment. That is better done in a complete new header I think ...

You must log in to answer this question.

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