如何在简历中添加照片

如何在简历中添加照片

我正在尝试在我的简历中插入一个\photo带有类命令的图像moderncv,但是我尝试了一段时间但没有成功。

我正在使用以下脚本:

\documentclass[11pt,a4paper,sans]{moderncv}

\usepackage{graphicx}%allows to import images

\photo[64pt][0.4pt]{/Users/Xime/Documents/CV_LateX/cv_template/Foto_CV.png}  

我没有收到任何错误消息,但图像没有出现在文档中。

有人知道可能是什么问题吗?

答案1

除了使用\photo命令之外,您还可以使用以下命令

\begin{document}在命令前插入以下代码

\usepackage{graphicx}
\graphicspath{ {images/} }

并且在使用之前,此命令确保创建一个名为的文件夹图片在您使用 tex 文件的电脑的同一文件夹中。将图像保存在此文件夹中,复制图像名称。之后,您可以在代码中的任何位置使用以下命令:

\includegraphics[width=1.15in, height=1.40in]{name_of_your_image.jpg}

要了解有关此命令的更多信息,请访问此处https://www.sharelatex.com/learn/Positioning_images_and_tables

PS:以后在提问时,尽量提供代码示例(代码的最少行数,并指出问题主要出现在代码中的特定部分)(这样其他人就可以通过在自己的电脑上运行它来了解问题所在)

答案2

看起来(您没有给我们可编译的代码来测试!)您正在使用的样式bankingmoderncv包含简历中的图像。

请参阅以下内容:

\documentclass[11pt,a4paper,sans]{moderncv}

% moderncv themes
\moderncvstyle{banking} % casual, classic, banking, oldstyle and fancy
\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}

%\setlength{\footskip}{66pt}


\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution--3}{City--4}{\textit{Grade}--5}{Description--6}  % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\section{Languages}
\cvitemwithcomment{Language 1}{Skill level}{Comment}
\cvitemwithcomment{\textbf{Language} 2}{\textbf{Skill} level}{Comment}
\cvitemwithcomment{Language 3}{Skill level}{Comment}

\end{document}

其结果是:

生成的 pdf

现在将已经定义的照片添加到银行样式的标题中的最简单的方法是在序言中使用以下代码:

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

这样就会将照片添加到旧标题上方的中心。

注意:简单地\includegraphics[width=64pt]{example-image-duck}在 cv 代码中添加内容并没有帮助,正如您在下面的 mwe 中所看到的。

完成 mwe:

\documentclass[11pt,a4paper,sans]{moderncv}

% moderncv themes
\moderncvstyle{banking} % casual, classic, banking, oldstyle and fancy
\moderncvcolor{blue} 

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

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

% 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}

%\setlength{\footskip}{66pt}


\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution--3}{City--4}{\textit{Grade}--5}{Description--6}  % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\includegraphics[width=64pt]{example-image-duck} % <====================

\section{Languages}
\cvitemwithcomment{Language 1}{Skill level}{Comment}
\cvitemwithcomment{\textbf{Language} 2}{\textbf{Skill} level}{Comment}
\cvitemwithcomment{Language 3}{Skill level}{Comment}

\end{document}

结果如下:

结果

如您所见,标题图像位于标题上方的中央,example-image-duck稍后会显示单独的图像。如果您想让图像位于银行标题的左侧或右侧,您最终需要重写银行标题以获得令人满意的结果(完整标题,包括居中或右/左对齐的图像)。但因为您没有说明想要将图像放在哪里,所以我就为您做了这件事。

要查看所有可能性moderncv,请参阅 我对这个问题的回答

相关内容