将照片添加到 moderncv 样式银行业务并进行修改

将照片添加到 moderncv 样式银行业务并进行修改

如何将照片添加到 moderncv 样式银行业务中

继续上述问题。

如何修改代码,使照片只出现在简历页面,而不出现在信件页面?并且还可以选择照片放在标题顶部还是标题旁边?

答案1

假设您使用以下解决方案来添加徽标(取自@karlkoeller 的答案):

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

然后你会看到一行\let\oldmakecvtitle\makecvtitle。这意味着原始宏已备份到新宏中oldmakecvtitle。因此可以更改原始宏以包含照片。

如果您想使用原始宏,只需调用旧宏:

\oldmakecvtitle  % Instead of \makecvtitle

请参阅以下 MWE,根据需要获取带有照片的简历和不带照片的信件:

\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{[email protected]}
\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} 

结果如下:

带照片的简历

没有照片的信件

如果您想使用宏\makecvtitle代替,则\oldmakecvtitle可以使用以下行(在调用之前\makecvtitle):

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

如果您将插入的照片代码更改为:

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

您获得的照片与标题完全一致。

相关内容