在 moderncv 中,如何将 \extrainfo xing 从 http 更改为 https?

在 moderncv 中,如何将 \extrainfo xing 从 http 更改为 https?

moderncv:我使用以下方式添加了我的 xing 配置文件\extrainfo:我根据此来源

但是,链接是http,我想改为https

附加信息: 也许可以调整一下操作说明关于如何更改社交 linkedin 个人资料,但没有找到具体方法。

最小工作示例:

\documentclass{moderncv}
\moderncvstyle{casual}
\makeatletter
\RenewDocumentCommand{\social}{O{}O{}m}{%
  \ifthenelse{\equal{#2}{}}%
    { 
    \ifthenelse{\equal{#1}{linkedin}}{\collectionadd[linkedin]{socials}{\protect\href{https://www.linkedin.com/in/#3}{#3}}}{}%
      \ifthenelse{\equal{#1}{twitter}} {\collectionadd[twitter]{socials} {\protect\httplink[#3]{www.twitter.com/#3}}}    {}%
      \ifthenelse{\equal{#1}{github}}  {\collectionadd[github]{socials}  {\protect\httplink[#3]{www.github.com/#3}}}     {}%
    }
    {\collectionadd[#1]{socials}{\protect\httplink[#3]{#2}}}}
\makeatother
\name{Daniel}{Nahmias}
\social[linkedin]{danielnahmias} 
%\social[xing]{Daniel_Nahmias} % currently doesn't work, so that I use \extrainfo
%\social[twitter]{jdoe}        not needed
%\social[github]{jdoe}        not needed
%\social[gitlab]{jdoe}        not needed
%\social[skype]{jdoe}        not needed
\extrainfo{\httplink[\faXingSquare~Daniel Nahmias]{xing.com/profile/Daniel_Nahmias}} 
\begin{document}
\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\end{document}

答案1

你必须改变三件事:

  1. 您需要为 xing 符号添加新的定义:\newcommand*{\xingsocialsymbol} {\faXingSquare~}
  2. 添加新命令\httpslink,例如

    \newcommand*{\httpslink}[2][]{% <=======================================
      \ifthenelse{\equal{#1}{}}%
        {\href{https://#2}{#2}}%
        {\href{https://#2}{#1}}}
    
  3. 在 socials 命令中为 xing 添加新的定义:

    \ifthenelse{\equal{#1}{xing}}{\collectionadd[xing]{socials}{\protect\httpslink[#3]{www.xing.com/profile/#3}}}{}%
    

因此,有了以下完整的 MWE

\documentclass{moderncv}

% makes a https hyperlink
% usage: \httpslink[optional text]{link}
\newcommand*{\httpslink}[2][]{% <=======================================
  \ifthenelse{\equal{#1}{}}%
    {\href{https://#2}{#2}}%
    {\href{https://#2}{#1}}}

\newcommand*{\xingsocialsymbol}  {\faXingSquare~} % <===================

\moderncvstyle{casual}

\makeatletter
\RenewDocumentCommand{\social}{O{}O{}m}{%
  \ifthenelse{\equal{#2}{}}%
    { 
    \ifthenelse{\equal{#1}{linkedin}}{\collectionadd[linkedin]{socials}{\protect\href{https://www.linkedin.com/in/#3}{#3}}}{}%
    \ifthenelse{\equal{#1}{xing}}{\collectionadd[xing]{socials}{\protect\httpslink[#3]{www.xing.com/profile/#3}}}{}% <================================================================
      \ifthenelse{\equal{#1}{twitter}} {\collectionadd[twitter]{socials} {\protect\httplink[#3]{www.twitter.com/#3}}}    {}%
      \ifthenelse{\equal{#1}{github}}  {\collectionadd[github]{socials}  {\protect\httplink[#3]{www.github.com/#3}}}     {}%
    }
    {\collectionadd[#1]{socials}{\protect\httplink[#3]{#2}}}}
\makeatother

\name{Daniel}{Nahmias}
\social[linkedin]{danielnahmias} 
\social[xing]{Daniel\_Nahmias} % <======================================
%\social[twitter]{jdoe}        not needed
%\social[github]{jdoe}        not needed
%\social[gitlab]{jdoe}        not needed
%\social[skype]{jdoe}        not needed


\begin{document}

\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\end{document}

你得到了想要的结果:

在此处输入图片描述

答案2

两种方式都有(但第一种没有徽标):

\documentclass{moderncv}
\moderncvstyle{casual}
\makeatletter
\RenewDocumentCommand{\social}{O{}O{}m}{%
  \ifthenelse{\equal{#2}{}}%
    { 
    \ifthenelse{\equal{#1}{linkedin}}{\collectionadd[linkedin]{socials}{\protect\href{https://www.linkedin.com/in/#3}{#3}}}{}%
     \ifthenelse{\equal{#1}{xing}}{\collectionadd[xing]{socials}{\protect\href{https://wwww.xing.com/#3}{$#3$}}}{}%
      \ifthenelse{\equal{#1}{twitter}} {\collectionadd[twitter]{socials} {\protect\httplink[#3]{www.twitter.com/#3}}}    {}%
      \ifthenelse{\equal{#1}{github}}  {\collectionadd[github]{socials}  {\protect\httplink[#3]{www.github.com/#3}}}     {}%
    }
    {\collectionadd[#1]{socials}{\protect\httplink[#3]{#2}}}}
\makeatother
\name{Daniel}{Nahmias}
\social[linkedin]{danielnahmias} 
\social[xing]{Daniel_Nahmias} % currently doesn't work, so that I use \extrainfo
%\social[twitter]{jdoe}        not needed
%\social[github]{jdoe}        not needed
%\social[gitlab]{jdoe}        not needed
%\social[skype]{jdoe}        not needed
\extrainfo{\url{https:www.xing.com/profile/Daniel_Nahmias}}
\begin{document}
\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\end{document}

相关内容