1

As suggested here, I use symbols drawn with tikz to indicate hyperlinks in my cv. However when used in the cventry command of the modern cv package, this caused an error. Here is the minimal non-working example

\documentclass[11pt,a4paper,color,final]{moderncv}
\usepackage{tikz}
\newcommand{\ExternalLink}{%
  \tikz[x=1.2ex, y=1.2ex, baseline=-0.05ex]{% 
    \begin{scope}[x=1ex, y=1ex]
      \clip (-0.1,-0.1) 
      --++ (-0, 1.2) 
      --++ (0.6, 0) 
      --++ (0, -0.6) 
      --++ (0.6, 0) 
      --++ (0, -1);
      \path[draw, 
        line width = 0.5, 
      rounded corners=0.5] 
      (0,0) rectangle (1,1);
    \end{scope}
    \path[draw, line width = 0.5] (0.5, 0.5) 
    -- (1, 1);
    \path[draw, line width = 0.5] (0.6, 1) 
    -- (1, 1) -- (1, 0.6);
  }
}

\moderncvtheme[black]{classic}

\firstname{FirstName}
\familyname{Name}

\begin{document}

\maketitle

\section{Section}
\cventry{2014}{\href{http://example.com/ \ExternalLink}{My great position}}{My great company}{My great city}{}{}

\end{document}

Edit following Salim Bou's answer. The following works

\cventry{2014}{\href{http://example.com/}{My great position \ExternalLink}}{My great company}{My great city}{}{}

(The symbol shoulb be placed in the string not in the url).

However this still produces an error

\cventry{2014}{My great position}{\href{http://example.com/}{My great company \ExternalLink}}{My great city}{}{}

Looking at the log the error looks quite similar. Latex is complaining about some error message being undefined.

1
  • You can use \cventry{2014}{My great position}{\href{http://example.com/}{My great company \protect\ExternalLink}}{My great city}{}{}
    – Salim Bou
    Commented Dec 27, 2016 at 15:25

2 Answers 2

5

You need to include your symbol like this

\cventry{2014}{\href{http://example.com/}{\ExternalLink My great position}}
{My great company}{My great city}{}{}
1
  • Ok this solves the initial problem but there is still a bug. I edited my question in regard of your answer.
    – Ronan
    Commented Dec 27, 2016 at 14:45
0

This is an old question, but since it's the first result that appears when searching for "moderncv tikz error", here's my take.

Use \DeclareRobustCommand instead of \newcommand to define the TikZ macro. That's it. See this other question if you are interested in understanding why.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .