8

I wrote the following code:

\documentclass[11pt,a4paper,sans]{moderncv}

\moderncvstyle{casual}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}

\makeatletter
\newcommand\faSkype{{\FA\symbol{"F17E}}}
\makeatother

\name{John}{Doe}
\extrainfo{\href{skype:jdoe}{\faSkype{} jdoe}}

\begin{document}

\makecvtitle

\end{document}

which add a clickable Skype profile on the CV.

Is there a way to extend the existing social command in order to accept Skype as optional parameter, in order to write a more readable thing like this?

\social[skype]{jdoe}

2 Answers 2

6

Now it is possible to do it this way:

\newcommand*\skypesocialsymbol{{\FA\symbol{"F17E}}}
\social[skype][skype.com/user/jdoe]{jdoe}

You just have to change the url accordingly.

3
  • 1
    Not-a-LaTeX-expert here. I love your one-liner solution. I had to adapt it though: \newcommand*\skypesocialsymbol{{\faSkype~}} worked. Apr 12, 2018 at 10:07
  • @MorganCourbet's solution works well. It simply requires the fontawesome package.
    – myrdd
    May 23, 2018 at 9:53
  • Amazing thank you. You can also use \newcommand*\anysocialsymbol{\includegraphics[height=11pt]{anysymbol.png}} to include any symbol btw.
    – Lukas
    Feb 18 at 10:52
2

The following code in the preamble does the trick!

% hlink
\makeatletter
\newcommand*{\hlink}[2][]{%
  \ifthenelse{\equal{#1}{}}%
    {\href{#2}{#2}}%
    {\href{#2}{#1}}}
\makeatother

% social
\makeatletter
\newcommand*{\facebooksocialsymbol}{\faFacebook~}
\newcommand\faSkype{{\FA\symbol{"F17E}}}
\newcommand*{\skypesocialsymbol}{\faSkype~}
\RenewDocumentCommand{\social}{O{}O{}m}{%
  \ifthenelse{\equal{#2}{}}%
    {%
      \ifthenelse{\equal{#1}{linkedin}}{\collectionadd[linkedin]{socials}{\protect\httplink[#3]{www.linkedin.com/in/#3}}}{}%
      \ifthenelse{\equal{#1}{twitter}} {\collectionadd[twitter]{socials} {\protect\httplink[#3]{www.twitter.com/#3}}}    {}%
      \ifthenelse{\equal{#1}{facebook}}{\collectionadd[facebook]{socials}{\protect\httplink[#3]{www.facebook.com/#3}}}   {}%
      \ifthenelse{\equal{#1}{github}}  {\collectionadd[github]{socials}  {\protect\httplink[#3]{www.github.com/#3}}}     {}%
      \ifthenelse{\equal{#1}{skype}}   {\collectionadd[skype]{socials}   {\protect\hlink[#3]{skype:#3}}}              {}%
    }
    {\collectionadd[#1]{socials}{\protect\httplink[#3]{#2}}}}
\makeatother

Step by step explanation:

Create a "hlink" command: This is needed because the skype link is not a link to a web page

\makeatletter
\newcommand*{\hlink}[2][]{%
  \ifthenelse{\equal{#1}{}}%
    {\href{#2}{#2}}%
    {\href{#2}{#1}}}
\makeatother

Create commands for the symbols that will be used. Note that the skype symbol is not in the default Font Awesome command sets and thus needs a different solution than the facebook symbol

\newcommand*{\facebooksocialsymbol}{\faFacebook~}
\newcommand\faSkype{{\FA\symbol{"F17E}}}
\newcommand*{\skypesocialsymbol}{\faSkype~}

Lastly, edit the original social command to include these symbols:

\RenewDocumentCommand{\social}{O{}O{}m}{%
  \ifthenelse{\equal{#2}{}}%
    {%
      \ifthenelse{\equal{#1}{linkedin}}{\collectionadd[linkedin]{socials}{\protect\httplink[#3]{www.linkedin.com/in/#3}}}{}%
      \ifthenelse{\equal{#1}{twitter}} {\collectionadd[twitter]{socials} {\protect\httplink[#3]{www.twitter.com/#3}}}    {}%
      \ifthenelse{\equal{#1}{facebook}}{\collectionadd[facebook]{socials}{\protect\httplink[#3]{www.facebook.com/#3}}}   {}%
      \ifthenelse{\equal{#1}{github}}  {\collectionadd[github]{socials}  {\protect\httplink[#3]{www.github.com/#3}}}     {}%
      \ifthenelse{\equal{#1}{skype}}   {\collectionadd[skype]{socials}   {\protect\hlink[#3]{skype:#3}}}              {}%
    }
    {\collectionadd[#1]{socials}{\protect\httplink[#3]{#2}}}}
\makeatother

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.