10

I would like to include a picture in banking style moderncv pacakge. I just want to locate it in right hand side from title. But.. I can do this with a simple

\includegraphics[scale=1]{picture} 

because the picture is above or below title. I´ve thought in TikZ to create a node where I can put the picture but I´m not sure about this solution. Anyone know how could get it?

enter image description here

18

Update (moderncv v2.0)

With moderncv v2.0, the command to be patched is no more \maketitle but \makehead and the length to be changed is now \makeheaddetailswidth, so the correct patches for this version are

\patchcmd{\makehead}
  {\hfil}
  {\hspace*{0.15\textwidth}}
  {}
  {}
\patchcmd{\makehead}
  {\setlength{\makeheaddetailswidth}{0.8\textwidth}}
  {\setlength{\makeheaddetailswidth}{0.67\textwidth}}
  {}
  {}
\patchcmd{\makehead}
  {\\[2.5em]}
  {\hfil\raisebox{-.7cm}{\framebox{\includegraphics[width=\@photowidth]{\@photo}}}\\[2.5em]}
  {}
  {}

Original answer (works with older versions of moderncv)

Add the following lines in your preamble

\patchcmd{\maketitle}
  {\hfil}
  {\hspace*{0.15\textwidth}}
  {}
  {}
\patchcmd{\maketitle}
  {\setlength{\maketitlewidth}{0.8\textwidth}}
  {\setlength{\maketitlewidth}{0.67\textwidth}}
  {}
  {}
\patchcmd{\maketitle}
  {\\[2.5em]}
  {\hfil\raisebox{-.7cm}{\framebox{\includegraphics[width=\@photowidth]{\@photo}}}\\[2.5em]}
  {}
  {}

and, to insert the picture, use

\photo[64pt][0.4pt]{picture}

MWE:

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}

\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}

\patchcmd{\maketitle}
  {\hfil}
  {\hspace*{0.15\textwidth}}
  {}
  {}
\patchcmd{\maketitle}
  {\setlength{\maketitlewidth}{0.8\textwidth}}
  {\setlength{\maketitlewidth}{0.67\textwidth}}
  {}
  {}
\patchcmd{\maketitle}
  {\\[2.5em]}
  {\hfil\raisebox{-.7cm}{\framebox{\includegraphics[width=\@photowidth]{\@photo}}}\\[2.5em]}
  {}
  {}

% personal data
\name{John}{Doe}
\title{Resumé title}
\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}
\social[linkedin]{john.doe}
\social[twitter]{jdoe}
\social[github]{jdoe}
\extrainfo{additional information}

\photo[64pt][0.4pt]{picture}

\begin{document}

\makecvtitle

\end{document} 

Output:

enter image description here

4
  • +1 I nearly commented in mine that one ought to insert the image into a redefined maketitle but since a CV is presumably a one-off document I decided to go for simpler if less logically pure markup:-) – David Carlisle Jan 16 '14 at 13:42
  • That´s exactly what I want. Thank you. But I don´t understand how I can reduce the space between title and picture, I mean, horizontal lenght between them. – FJSJ Jan 16 '14 at 14:29
  • 1
    @FJSJ In the last \patchcmd remove \hfil. If it is not enough, substitute it with \hspace*{-15pt} and adjust -15pt to your needs. You can also adjust -.7cm in \raisebox to adjust the vertical placement. – karlkoeller Jan 16 '14 at 16:24
  • 1
    To complete the patch, add \setlength{\fboxrule}{\@photoframewidth} before the \framebox, this respects any given border width. Thanks for the patch anyways :) – resi Jul 27 '17 at 18:11
9

Put the picture in any convenient place in the source and use

\begin{picture}(0,0)
\put(20,30){\includegraphics[scale=1]{picture}}
\end{picture}

The (0,0) means that the construct takes up no space and will over (or under) print any surrounding text, then adjust the coordinates (20,30) to put it where you like, default units pt but you can change \unitlength so that you can use cm or in or whatever.

2
  • I´ve tried to do this with \put command but It didn´t work. Now with your tip is perfect. This option has advantage in cover letter (if you don´t want to show picture in it). Thank you again! – FJSJ Jan 16 '14 at 14:36
  • +1 because you're the best and your answers are always useful :-) – karlkoeller Jan 16 '14 at 16:24

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.