# Signature over printed name in a moderncv letter

When trying to get the signature (transparent PNG) properly placed using the following code:

\name{Andrés}{BC}
\closing{\color{red}Atentamente,\\ \vspace{-10pt}\parbox{120pt}%
{\includegraphics[width=1\linewidth]{transpSign.PNG}}\vspace{-45pt}}


in the head and \makeletterclosing in the document, I get the following z order in the output PDF (the signature here is printed over the "Atentamente," but under the "Andrés...". I would like it to be over every typed text):

As it seems I get the z order given by the code order, is there any way to force the desired z order but using \name, \closing and \makeletterclosing? The use of these commands doesn't allow fixing it by writing things in the desired z order plus some negative space to position the signature, or something like the solution proposed here.

## 1 Answer

REVISED ANSWER

Upon comment from the OP, it became more clear that the OP desired to have a transparent signature image overlay the page text. The problem with my original solution was that the image was laid down prior to the name, and thus underlaid the name.

Attempting to make the signature a \stackon overlay to the name also did not work, because the name shows up not only in the letter salutation but also in the upper right of the moderncv document page. Thus, the signature overlay also showed up in two places on the page.

Therefore, the solution here was to use my approach of How can I make a perfect page grid that fits my page for measuring purposes in TikZ?, using atbegshi to overlay something on a page at absolute coordinates (unlike my similar answer at What are the ways to position things absolutely on the page? using everypage which underlays something on a page at absolute coordinates).

My MWE does not use a transparent image, but that should not pose a complication.

\documentclass[sans]{moderncv}
\usepackage{stackengine,lipsum}
\moderncvstyle{classic}
\firstname{John}
\familyname{Doe}

\usepackage{etoolbox}
\patchcmd{\makeletterclosing}{3em}{4em}{}{}

\def\PageTopMargin{1in}
\def\PageLeftMargin{1in}
\newcommand\atxy[3]{%
\AtBeginShipoutNext{\AtBeginShipoutAddToBoxForeground{%
\smash{\hspace*{\dimexpr-\PageLeftMargin-\hoffset+#1\relax}%
\raisebox{\dimexpr\PageTopMargin+\voffset-#2\relax}{\textcolor{red!80}{#3}}}}}}

\begin{document}

\recipient{Company Org}{Company\\Street\\City}
\date{\today}
\opening{Dear Sir or Madam,}
\name{Andres}{BC}
\closing{\color{red}Atentamente,}
\enclosure[Attached]{curriculum vit\ae{}}
\makelettertitle

\lipsum[1-2]

\makeletterclosing

\atxy{1.64in}{8.1in}{%
\includegraphics[width=\linewidth,height=55pt]{example-image}}
\end{document}


ORIGINAL SOLUTION

It is not exactly clear how you would like things to appear, but here I use \stackunder to place the graphical image (signature?) under the Atentamente label. One can play with the optional argument to \stackunder to specify the gap of the underset, depending on the height of your signature (which I manually specified as 25pt).

\documentclass[sans]{moderncv}
\usepackage{stackengine,lipsum}
\moderncvstyle{classic}
\firstname{John}
\familyname{Doe}

\usepackage{etoolbox}
\patchcmd{\makeletterclosing}{3em}{4em}{}{}

\begin{document}

\recipient{Company Org}{Company\\Street\\City}
\date{\today}
\opening{Dear Sir or Madam,}
\name{Andres}{BC}
\closing{\def\stackalignment{l}\color{red}\mbox{}\smash{%
\stackunder[20pt]{Atentamente,}%
{\includegraphics[width=1\linewidth,height=25pt]{example-image}}}}
\enclosure[Attached]{curriculum vit\ae{}}
\makelettertitle

\lipsum[1-2]

\makeletterclosing

\end{document}


• I also use classic style, but \stackunder produces an undefined control sequence error. Thinking it better now, I don't think I explained myself very well in the question, as your image doesn't show that my problem has been solved. In the question I was talking of a signature transparent PNG which, in my image, is printed over the "Atentamente," but under the "Andrés...". I would like it to be over every typed text. Apr 21 '16 at 16:30
• @Andrestand First, \stackunder requires the use of the stackengine package. As to the transparent image with overlap, I did not fully appreciate this aspect of the problem. One would have to attach the stack to the last glyph printed, which would be your name, rather than the "Atentamente". I will give more thought on how to do that. Apr 21 '16 at 17:17
• @Andrestand Please see my revised answer. Apr 22 '16 at 2:23