4

When \photo is used in moderncv, it includes a ~3px padding between the image and the border. How does one remove this? I have found the part of the moderncvstyleclassic.sty that deals with the photo (line 160), but don't know how to change it. I'd also like to know how to change the colour of the border, or even remove it entirely.

5
  • Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Commented May 10, 2013 at 9:09
  • It's also very important to add you version of moderncv. In the last weeks there are many updates. Commented May 10, 2013 at 9:10
  • 1
    The current macro \photo has two options, one for the photo size, one for the thickness of the border. To remove the border use 0pt.
    – Mensch
    Commented May 10, 2013 at 10:44
  • Guess I'm using an old version of moderncv then T_T
    – user973066
    Commented May 10, 2013 at 11:51
  • I believe the answer by @nathdwek is more accurate. That removed the white padding between the border and the image using \setlength{\fboxsep}{0pt} instead of removing the entire border with the other option Commented Jun 12, 2018 at 12:19

3 Answers 3

4

To remove the border for the border just use a current version of moderncv and try the following MWE (just to show you how a MWE could be for your case). In line 21 you have the border activated, in the commented line 22 the border is deactivated. Just move the comment sign %.

The macro \photo[width photo][border thickness]{name of photo} does for you what you want.

Please note that I used a picture from package MWE, that should be installed on your computer but must not be loaded to use the included pictures.

%http://tex.stackexchange.com/questions/113566/remove-photo-padding-in-moderncv-classic
\documentclass[11pt,a4paper,sans]{moderncv} 
\moderncvstyle{casual}  
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}

%\setlength{\hintscolumnwidth}{3cm}  % change the width of the column with the dates
\setlength{\footskip}{37pt} % defines space for footer

% personal data
\firstname{John}
\familyname{Doe}
\title{Resumé title}         % optional, remove / comment the line if not wanted
\address{street and number}{postcode city}{country}% optional, ...
\mobile{+1~(234)~567~890}                          % optional, ...
\phone{+2~(345)~678~901}                           % optional, ...
\fax{+3~(456)~789~012}                             % optional, ...
\email{[email protected]}                               % optional, ...
\homepage{www.johndoe.com}                         % optional, ...
\extrainfo{additional information}                 % optional, ...
 \photo[64pt][0.4pt]{example-image-a}              % Photo with border with 0.4pt thickness
%\photo[64pt][0pt]{example-image-a}                % Photo without border 
\quote{Some quote}                                 % optional, ...

\begin{document}

\makecvtitle
% your datas ...

\end{document} %===== File mwe-mcv.tex =====
4

The previous answer covered how to remove the border altogether around the photo in moderncv, using the syntax provided by this package. Here I'm going to show you how to remove the padding, which was initially asked and is a little bit less immediate (using moderncv 1.5.1).

moderncv uses a \framebox{} to get a border around your photo. As shown in here, the only way to modify the padding is through the \fboxsep variable. Knowing that you can use the command \setlength{\fboxsep}{0pt} somewhere before the \photo command in order to remove the padding (be it preambule or near the photo declaration, or even in the package itself, depending on how it makes most sense to you)

MWE:

\documentclass[10pt, a4paper]{moderncv}

%% ModernCV themes
\moderncvstyle{classic}
\moderncvcolor{red}

%% Character encoding
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

%% Personal data
\firstname{John}
\familyname{Doe}
\address{Don Knuth Street, 42}{Tex City}
\setlength{\fboxsep}{0pt}
\photo[64pt][0.8pt]{placeholder.png}

\begin{document}
\makecvtitle
\end{document}

Output:

0

To complete what has already been said and answer the second part of the question, if you want to change the color of the border, you can do this :

\renewcommand\fbox{\fcolorbox{\lightgray}{white}}

To be placed before the command \photo. This will set the borders to lightgray and the background to white. Note that this should change the border colors of any element using fbox, so it may not be optimal.

Source: https://tex.stackexchange.com/a/446556/203822

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .