3

Hello I am new to LaTeX and like it!

In moderncv I have a Link to my Linkedin profile. However, this link is http and I'd like to change to https.

Example

    \documentclass[11pt,a4paper,sans]{moderncv}
    \moderncvstyle{casual}
    \moderncvcolor{blue}
    \usepackage[scale=0.75]{geometry}

    \name{John}{Doe}
    \social[linkedin]{reidhoffman}

    \begin{document}

    \makecvtitle

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

    \end{document}

I tried to customize the link as described in Fixing the '\social' command of 'moderncv' for LinkedIN (intl profile) but it doesn't accept https.

If you need a minimal working example, just use the default template of moderncv at http://www.pirbot.com/mirrors/ctan/macros/latex/contrib/moderncv/examples/template.tex . Thanks in advance!

1

A fix by "renew-ing" the documentclass command to use \href{}{} for this page:

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{casual}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}

% Added these lines (until `\makeatother` that belongs to documentclass `moderncv.cls`)
\makeatletter
\RenewDocumentCommand{\social}{O{}O{}m}{%
  \ifthenelse{\equal{#2}{}}%
    {%NEXT LINE CHANGED FROM ORIGINAL
      \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{John}{Doe}
    \social[linkedin]{reidhoffman}


    \begin{document}

    \makecvtitle

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

\end{document}
| improve this answer | |
1

You need simply to define a new command \httpslink like

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

Then you can simply change the call of \httplink to \httpslink to get your wished result.

Please see the following MWE (important code changings marked with <======):

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

\moderncvstyle{casual}
\moderncvcolor{blue}

\usepackage[scale=0.75]{geometry}

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

% adds a social link to one's personal information (optional)
% usage: \social[<optional type>][<optional url>]{<account name>}
% where <optional type> should be either "linkedin", "twitter" or "github"
\RenewDocumentCommand{\social}{O{}O{}m}{% <=============================
  \ifthenelse{\equal{#2}{}}%
    {%
      \ifthenelse{\equal{#1}{linkedin}}{\collectionadd[linkedin]{socials}{\protect\httpslink[#3]{www.linkedin.com/in/#3}}}{}% <==========================================
      \ifthenelse{\equal{#1}{twitter}} {\collectionadd[twitter]{socials} {\protect\httpslink[#3]{www.twitter.com/#3}}}    {}% <=====================
      \ifthenelse{\equal{#1}{github}}  {\collectionadd[github]{socials}  {\protect\httpslink[#3]{www.github.com/#3}}}     {}% <=====================
    }
    {\collectionadd[#1]{socials}{\protect\httpslink[#3]{#2}}}}


\name{John}{Doe}
\social[linkedin]{reidhoffman}


\begin{document}

\makecvtitle

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

\end{document}

which gives you the wished result: https://www.linkedin.com/in/reidhoffman. Please see that I changed the old protocolls httplink to httpslink also for all other possibilitys command \social gave you to add social links to your cv ...

| improve this answer | |

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.