[Tex/LaTex] Add photo to moderncv style banking with modifications

graphicsmoderncv

How to add a photo to moderncv style banking

Follow up question from the above.

How is the modification of the code create the photo only on the resume page but not to the letter page? And also with choice photo on the top of the title or at the side in line with the title?

Best Answer

Suppose you used the following solution to add the logo (taken from the answer of @karlkoeller):

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

Then you see line \let\oldmakecvtitle\makecvtitle. That means that the original macro is backuped in the new macro oldmakecvtitle. So the original macro can be changed to include the photo.

If you want to use the original macro just call the old macro:

\oldmakecvtitle  % Instead of \makecvtitle

See the following MWE to get a CV with photo, a letter without photo as you need:

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

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

% 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]{example-image-a}
\quote{Some quote}

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

\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\section{Master thesis}
\cvitem{title}{\emph{Title}}
\cvitem{supervisors}{Supervisors}
\cvitem{description}{Short thesis abstract}

\clearpage
%\let\makecvtitle\oldmakecvtitle % to change back, if needed
\oldmakecvtitle % <=======================================================

% recipient data
\recipient{Company Recruitment team}{Company, Inc.\\123 somestreet\\some city}
\date{January 01, 1984}
\opening{Dear Sir or Madam,}
\closing{Yours faithfully,}
\enclosure[Attached]{curriculum vit\ae{}}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis ullamcorper 
neque sit amet lectus facilisis sed luctus nisl iaculis. Vivamus at neque 
arcu, sed tempor quam. Curabitur pharetra tincidunt tincidunt. Morbi 
volutpat feugiat mauris, quis tempor neque vehicula volutpat. Duis 
tristique justo vel massa fermentum accumsan. Mauris ante elit, feugiat 
vestibulum tempor eget, eleifend ac ipsum. Donec scelerisque lobortis 
ipsum eu vestibulum. Pellentesque vel massa at felis accumsan rhoncus.


Albert Einstein discovered that $e=mc^2$ in 1905.

\[ e=\lim_{n \to \infty} \left(1+\frac{1}{n}\right)^n \]

\makeletterclosing

\end{document} 

with the results:

CV with Photo

and

Letter without photo

If you want to use macro \makecvtitle instead of \oldmakecvtitle you can use the following line (before calling \makecvtitle):

\let\makecvtitle\oldmakecvtitle % to change back, if needed

If you cange the inserted code for the photo to:

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

You get the photo right in line with the title.