如何在 moderncv 的银行风格标题上方添加照片

如何在 moderncv 的银行风格标题上方添加照片

我正在使用 Overleaf 网站来撰写我的简历(moderncv风格banking),我想尝试在其中添加照片,但我不知道如何做。

代码中说我唯一要做的就是取消注释这一行:

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

好吧,我这样做了,我也将我的照片上传到 Overleaf 并附上标题picture.png,但什么也没发生,我的照片没有出现在简历上。以下是证据:

在此处输入图片描述

另请注意,我想把我的照片放在我的名字上方,而不是旁边,所以我搜索了一下我发现为了实现这一点,我应该在代码中添加以下几行:

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

有什么想法可以在 Overleaf 中做到这一点吗?

答案1

按照我们上一个问题中的方法操作即可。在行前添加此代码\begin[document}

请参阅此 MWE:

\documentclass[11pt,a4paper,roman]{moderncv}        % possible options include font size ('10pt', '11pt' and '12pt'), paper size ('a4paper', 'letterpaper', 'a5paper', 'legalpaper', 'executivepaper' and 'landscape') and font family ('sans' and 'roman')

\usepackage{xpatch}
\usepackage{lastpage}
\cfoot{\thepage\ / \pageref{LastPage}}

\makeatletter
% provide an expandable version of \roman
\newcommand{\exproman}[1]{\romannumeral\csname c@#1\endcsname}
% patch the commands in moderncv that use \roman
\xpatchcmd{\endcvcolumns}{\roman}{\exproman}{}{}
\xpatchcmd{\endcvcolumns}{\roman}{\exproman}{}{}
\xpatchcmd{\endcvcolumns}{\roman}{\exproman}{}{}
\xpatchcmd{\cvcolumn}{\roman}{\exproman}{}{}
\xpatchcmd{\cvcolumn}{\roman}{\exproman}{}{}
\xpatchcmd{\cvcolumn}{\roman}{\exproman}{}{}
\xpatchcmd{\cvcolumn}{\roman}{\exproman}{}{}
\xpatchcmd{\cvcolumn}{\roman}{\exproman}{}{}
\xpatchcmd{\collectionadd}{\roman}{\exproman}{}{}
\xpatchcmd{\collectionadd}{\roman}{\exproman}{}{}
\makeatother


% modern themes
\moderncvstyle{banking}  
\moderncvcolor{blue}    

% character encoding
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} 
\usepackage{kmath,kerkis}

\usepackage[english,greek]{babel}

\usepackage[scale=0.75]{geometry}


% personal data
\name{test}{test}
%\title{Biografik'o Shme'iwma}                               % optional, remove / comment the line if not wanted
\address{dress, city, postal}{}{}% optional, remove / comment the line if not wanted; the "postcode city" and and "country" arguments can be omitted or provided empty
\phone[mobile]{(+30) 325245345}                   % optional, remove / comment the line if not wanted

\email{[email protected]}                        
\social[linkedin]{gr.linkedin.com/in/test}
\photo[64pt][0.4pt]{example-image}

\xapptocmd\emailsymbol{\selectlanguage{english}}{}{}
\xapptocmd\homepagesymbol{\selectlanguage{english}}{}{}
\xapptocmd\linkedinsocialsymbol{\selectlanguage{english}}{}{}

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



\begin{document}

\makecvtitle

\end{document}

结果:

在此处输入图片描述

mwe(我使用了必须安装但未加载的包中的图片)

相关内容