Add second signature in moderncv

moderncv

I want the possibility to add another signature in \makeletterclosing within the moderncv package. I know, that the \makeletterclosing command is defined in the moderncvbodyi.sty file, and I can add the second name (second~name) manually:

\renewcommand*{\makeletterclosing}{
  \@closing\\[3em]%
  {\bfseries\@firstname~\@lastname second~name}%
  \ifthenelse{\isundefined{\@enclosure}}{}{%
    \\%
    \vfil%
    {\color{color2}\itshape\enclname: \@enclosure}}%
    \vfil}

However, I want the possibility to define that name within my document and not the package-file, e.g. by adding the following to my .tex document:

\documentclass[]{moderncv}
\moderncvstyle{casual}
\moderncvcolor{blue}

\firstname{My}
\familyname{Name}

\begin{document}
    
\recipient{Stackexchange}{Community}
\date{\today}
\opening{Dear Stackexchange,}
\closing{Sincerely,}
\makelettertitle
    
    Thank you for helping me.

\makeletterclosing
\end{document}

However, I don't know where and how to implement the variables \2ndfirstname and \2ndlastname. I also don't know where \firstname and \lastname are defined. If someone could point me to the correct file, I'd appreciate that

Best Answer

Assuming your code-snippet works, try sth. like this:

\renewcommand*{\makeletterclosing}[2][]{% <<== providing 2 parameters, and no option
  \@closing\\[3em]%
  {\bfseries\@firstname~\@lastname #2~#1}%  <<==
  \ifthenelse{\isundefined{\@enclosure}}{}{%
    \\%
    \vfil%
    {\color{color2}\itshape\enclname: \@enclosure}}%
    \vfil}

Then a call like this should work:

\makeletterclosing{Paul McCartney}

If the tilde '~' causes any trouble replace it by an ordinary space. I don't think the complete name will lead to a line break ;-)

Hint: Unfortunately your code snippet is too short to be good. As you can see, I have to guess, instead of verifying my answer before posting. It is good practice here to boil down code so much, that it both shows the problem AND still contains the observed error or problem (MWE: Minimum Working Example).