我正在尝试使用来moderncv
创建求职信。来自上一个搜索,我已经能够使用classic
样式创建 GitHub 图标,但它需要命令makecvtitle
。是否有选项可以使用来显示 GitHub 图标makelettertitle
?
答案1
好吧,在样式命令中\makecvtitle
,classic
您可以找到以下代码来定义您想要添加的社交信息:
\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 <===================================================
因此您需要 patch 命令\makeletterhead
来添加以下代码,例如:
\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
具有以下完整的 MWE(基于您链接的问题):
\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}
您将获得以下期望结果: