2

I am trying to use moderncv to create a cover letter. From previous search, I have been able to create GitHub icon using classic style, but it requires the command makecvtitle. Is there an option to display the GitHub icon with makelettertitle?

1 Answer 1

3

Well, in command \makecvtitle for the classic style you can find the following code defining the social informations you want to add:

\def\socialsdetails{}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
  \protected@edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}% 
\socialsdetails% to use it <===================================================

So you need to patch command \makeletterhead to add this code like:

\makeatletter
\patchcmd{\makeletterhead}
  {\ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}}
  {
    \def\socialsdetails{}%
    \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
      \protected@edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}% 
    \socialsdetails%
    \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
  }
  {}{}
\makeatother

With the following complete MWE (based on your linked question):

\documentclass[10pt,a4paper,sans]{moderncv}
\moderncvstyle{classic} % head 1 body 1 foot -
% load fontawesome icons
\usepackage{fontawesome}
% set the moderncv command for the Gitlab icon
% create command if it does not exist
\providecommand*{\gitlabsocialsymbol}{}
% set command to \faGitlab from fontawesome
\renewcommand*{\gitlabsocialsymbol}{{\scriptsize\faGitlab}~}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}
\name{Short}{LongName}
\email{[email protected]}
\phone[mobile]{+1123456789}
 \homepage{www.johndoe.com}
\social[linkedin]{asdf}
\social[twitter]{asdf}
\social[github]{asdfhub}
% set full url for the link
\social[gitlab][www.gitlab.com/asdflab]{asdflab}


\makeatletter
\patchcmd{\makeletterhead}
  {\ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}}
  {
    \def\socialsdetails{}%
    \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
      \protected@edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}% 
    \socialsdetails%
    \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
  }
  {}{}
\makeatother


\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution--3}{City--4}{\textit{Grade}--5}{Description--6}  % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\clearpage
\recipient{Company Recruitment team}{Company, Inc.\\123 somestreet\\some city}
\date{January 01, 1984}
\opening{Dear Sir or Madam,}
\closing{Yours faithfully,}
\enclosure[Attached]{curriculum vit\ae{}}
\makelettertitle
%\usebox{\makecvheaddetailsbox}
\end{document}

you get the following wished result:

resulting cv letter page

You must log in to answer this question.

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