[Tex/LaTex] Fixing the ‘\social’ command of ‘moderncv’ for LinkedIN (intl profile)

moderncv

I am using moderncv to compose my CV and cover letters.
I have a LinkedIN profile that I would like to link via

\social[linkedin]{...}

however line 257 of modencv.cls defaults the beginning of the link to www.linkedin.com/in/:

\ifthenelse{\equal{#1}{linkedin}}{\collectionadd[linkedin]{socials}{\protect\httplink[#3]{www.linkedin.com/in/#3}}}{}%

In my case, instead, the prefix and the suffix are respectively www.linkedin.com/pub/ and stefano-bragaglia/51/22/b43/ (instead of stefano.bragaglia, as suggested by the template).

In practice the base link should be changed in www.linkedin.com/ and the 2nd parameter of \social should be modified in pub/stefano-bragaglia/51/22/b43/.
At the moment I have created a copy of moderncv with the appropriate changes in my local repository, but I wonder whether it is better to include an appropriate \renewcommand (or similar) in the preamble of the file (what should I write) or just notify the author and ask for a fix.

If you need a minimal working example, just use the default template of moderncv.
Thanks in advance!

Best Answer

I think, in this case, you don't really need any redefinitions; the author/maintainer of moderncv has provided a second optional argument for \social that can be used, for example, in cases in which the prefixes/suffixes are different from the ones provided by default (when this second argument is not used). In this concrete case, you could say

\social[linkedin][www.linkedin.com/pub/stefano-bragaglia/51/22/b43/]{stefano-bragaglia}

A complete example:

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

\name{John}{Doe}
\social[linkedin][www.linkedin.com/pub/stefano-bragaglia/51/22/b43/]{stefano-bragaglia}


\begin{document}

\makecvtitle

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

\end{document}

An image of the resulting httplink and its associated address:

enter image description here

Some of the LinkedIn adresses have /in, some others /pub, so I guess the maintainer chose one by default, and provided the second optional argument for the other cases.