[Tex/LaTex] How to edit `\makeletterclosing` to insert graphic of signature

graphicslettersmoderncvspacingtemplates

I am using this popular formal letter template from Latextemplates.com. However, at the end it uses the command \makeletterclosing to print the closing message (something along the lines of "thank you sincerely" followed by a vertical space and then your name in bold.

However, I am interested in modifying this to insert a small image of my signature in the vertical space between "sincerely" and my printed name. My question is: where in the code would this go?

Here is the source code for the template:

%% start of file `template.tex'.
%% Copyright 2006-2013 Xavier Danaux (xdanaux@gmail.com).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.
%Version for spanish users, by dgarhdez

\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[spanish,es-lcroman]{babel}


% moderncv themes
\moderncvstyle{classic}                            % style options are 'casual' (default), 'classic', 'oldstyle' and 'banking'
\moderncvcolor{green}                              % color options 'blue' (default), 'orange', 'green', 'red', 'purple', 'grey' and 'black'
%\renewcommand{\familydefault}{\sfdefault}         % to set the default font; use '\sfdefault' for the default sans serif font, '\rmdefault' for the default roman one, or any tex font name
%\nopagenumbers{}                                  % uncomment to suppress automatic page numbering for CVs longer than one page

% character encoding
\usepackage[utf8]{inputenc}                       % if you are not using xelatex ou lualatex, replace by the encoding you are using
%\usepackage{CJKutf8}                              % if you need to use CJK to typeset your resume in Chinese, Japanese or Korean

% adjust the page margins
\usepackage[scale=0.75]{geometry}
%\setlength{\hintscolumnwidth}{3cm}                % if you want to change the width of the column with the dates
%\setlength{\makecvtitlenamewidth}{10cm}           % for the 'classic' style, if you want to force the width allocated to your name and avoid line breaks. be careful though, the length is normally calculated to avoid any overlap with your personal info; use this at your own typographical risks...

% personal data
\name{Nombre}{Apellido Apellido}
\title{Resumé title}                               % optional, remove / comment the line if not wanted
\address{Dirección}{CP, Ciudad}{País}% optional, remove / comment the line if not wanted; the "postcode city" and and "country" arguments can be omitted or provided empty
\phone[mobile]{000-000-000-000}                   % optional, remove / comment the line if not wanted
%\phone[fixed]{+2~(345)~678~901}                    % optional, remove / comment the line if not wanted
%\phone[fax]{+3~(456)~789~012}                      % optional, remove / comment the line if not wanted
\email{mailmailmail@gmail.com}                               % optional, remove / comment the line if not wanted
%\homepage{www.johndoe.com}                         % optional, remove / comment the line if not wanted
%\extrainfo{additional information}                 % optional, remove / comment the line if not wanted
%\photo[64pt][0.4pt]{picture}                       % optional, remove / comment the line if not wanted; '64pt' is the height the picture must be resized to, 0.4pt is the thickness of the frame around it (put it to 0pt for no frame) and 'picture' is the name of the picture file
%\quote{Some quote}                                 % optional, remove / comment the line if not wanted

% to show numerical labels in the bibliography (default is to show no labels); only useful if you make citations in your resume
%\makeatletter
%\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}
%\makeatother
%\renewcommand*{\bibliographyitemlabel}{[\arabic{enumiv}]}% CONSIDER REPLACING THE ABOVE BY THIS

% bibliography with mutiple entries
%\usepackage{multibib}
%\newcites{book,misc}{{Books},{Others}}
%----------------------------------------------------------------------------------
%            content
%----------------------------------------------------------------------------------
\begin{document}
%-----       letter       ---------------------------------------------------------
% recipient data
\recipient{Destinatario}{Departamento, Empresa}
\date{\today}
\opening{Estimado Destinatario,}
\closing{Muchas gracias por su tiempo e interés y reciba un cordial saludo.}
\enclosure[Adjunto]{CV}          % use an optional argument to use a string other than "Enclosure", or redefine \enclname
\makelettertitle

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque ultrices ultricies sapien et vehicula. Sed ut quam mattis, dignissim augue et, volutpat libero. Nulla facilisi. Nulla facilisi. Suspendisse eu libero ac mi tincidunt ullamcorper eu id risus. Maecenas dignissim tortor ac tellus tristique, et hendrerit risus finibus. Morbi rhoncus, ex in placerat lacinia, justo tortor posuere ipsum, ac scelerisque urna lectus porttitor quam. Quisque quis neque massa. Aenean metus ante, lacinia vitae eros ut, porta ullamcorper mi. Sed varius bibendum interdum. Aenean at ligula iaculis nulla egestas tristique sit amet eget eros. Nam tincidunt tempor neque a sollicitudin. Integer risus sapien, tempor vel congue eget, mattis sed mi. Nullam condimentum imperdiet pulvinar.

Nam in mi sagittis, rhoncus nisl id, elementum tortor. Pellentesque id risus laoreet mi ullamcorper gravida. Nunc eget orci vitae eros efficitur consectetur a porttitor urna. Suspendisse dapibus sapien ac nulla tincidunt fermentum. Suspendisse eleifend iaculis ex et porta. Morbi at dignissim velit. Nunc non lacus ut arcu luctus dapibus. Nulla facilisis vehicula ligula non malesuada. Sed fermentum placerat mi eu finibus. Morbi nulla velit, volutpat quis efficitur in, vestibulum sed odio. In tempus, quam quis bibendum iaculis, nulla mauris rutrum leo, pellentesque molestie est lacus ut neque. Integer luctus elementum ipsum sed molestie. Vestibulum non rutrum enim. Nulla iaculis finibus elementum. Phasellus faucibus ante et pretium semper.

Morbi volutpat in ligula ut blandit. Vivamus et arcu venenatis, faucibus ante nec, suscipit dolor. Duis id molestie sapien, nec dictum ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut at ante sem. Ut porttitor, tortor at convallis convallis, neque mi convallis ipsum, vel ultrices enim dolor sed diam. In dictum vulputate massa id molestie. Donec sollicitudin nisi vestibulum diam varius aliquet.



\vspace{0.5cm}


\makeletterclosing

\end{document}


%% end of file `template.tex'.

Edit: One more question I wanted to ask about this template, is what to modify to switch to the awesome icon set, similar to this question. I inserted the command \moderncvicons{awesome} in several places but the icons never changed.

Best Answer

Put this just before the \begin{document}

\makeatletter
\renewcommand*{\makeletterclosing}{
  \@closing\\[3em]%
  {\includegraphics[width=2cm]{example-image-a}
  \par
  \bfseries \@firstname~\@lastname}%
  \ifthenelse{\isundefined{\@enclosure}}{}{%
    \\%
    \vfill%
    {\color{color2}\itshape\enclname: \@enclosure}}}
\makeatother

Change \includegraphics[width=2cm]{example-image-a} accordingly.

Or with xpatch do this:

\usepackage{xpatch}
% \xpatchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\makeatletter
\xpatchcmd{\makeletterclosing}{\bfseries \@firstname~\@lastname}
                              {\includegraphics[width=2cm]{example-image-a}\par
                               \bfseries \@firstname~\@lastname}
                              {}{}
\makeatother

enter image description here

To use moderncvisonsawesome, remove

\usepackage[utf8]{inputenc}

and add

\usepackage{fontspec}
\moderncvicons{awesome} 

and compile with xelatex or lualatex.