5

I'm trying to insert an image with command \photo of class moderncv in my CV but I've been trying for a while without success.

I'm using the following script:

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

I don't receive any error message but the image does not appear in the document.

Does anybody know what could be the problem?

  • 2
    Welcome to tex.stackexchange! :) If you put 4 spaces in front, the code will be highlighted properly. Also, saying "hello" and "thanks" is not usually done in stackexchange posts. – fifaltra Jan 11 '18 at 22:37
  • 1
    Coud you please extend your code snippet to a full minimal working example (MWE)? In the code you already showed, there is no \moderncvstyle{<style>} command. If you use for example the banking style, no photo is included in the header. – leandriis Jan 11 '18 at 23:00
3

Instead of using \photo command you can use the following command

Insert the following code before your \begin{document} command

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

and before your use, this command make sure you make a folder named images in the same folder of your pc, where you are working with the tex file. keep your image in this folder, copy the name of your image. After that, you can use the following command anywhere in your code-

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

and to know more about this command go here https://www.sharelatex.com/learn/Positioning_images_and_tables

PS: In future, try to provide a sample of your code (minimum number of lines in code, and point out specific part of the code where your problem mainly is) for asking your problem (so that others can understand the problem by running it in their own pc)

2

It seems (you gave us no compilable code to test!) you are using the style banking of moderncv which does not include an image to the cv.

See the following 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}

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

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

Its result is:

resulting pdf

The simplest way now to add the already defined photo into the title of the banking style is to use the following code in the preamble:

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

That adds the photo centered above the old title.

Note: simply adding \includegraphics[width=64pt]{example-image-duck} inside the code of the cv does not help as you can see in the following mwe.

Complete 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{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}

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

with the result:

result

As you can see the title image is centered above the title, the separate image example-image-duck is displayed later. If you want to get the image on the left or right of the banking title you need at last to rewrite the banking title to get a pleasing result (complete title including image centered or right/left justified). But because you did not tell where you want the image I let this for you.

To see all posibilities moderncv offers, please see my answer to this question.

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.