[Tex/LaTex] Remove photo padding in moderncv classic

moderncvspacing

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.

Best Answer

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: