# Hyperref Not working with XeLatex - Undefined control sequence

I'm trying to add a link in the personal info part of my CV. I tried using

\url , \ref and \href

none of them is working with xelatex (you can see my code and the output down-below. I get an error " Undefined control sequence".
To be able to test this piece of code, you would need as well AltaCV Can anyone help me ?

\documentclass[10pt,a4paper,normalphoto]{altacv}
\geometry{left=1cm,right=9cm,marginparwidth=6.8cm,marginparsep=1.2cm,top=1.25cm,bottom=1.25cm}
\ifxetexorluatex
\else
% If using pdflatex:
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[default]{lato}
\usepackage[misc]{ifsym}
\usepackage{fontawesome}
\usepackage{fontawesome5}
\usepackage{hyperref}
\usepackage{tikz}
\usepackage{textpos}
\usepackage{url}
\usepackage{logreq}
\usepackage{xetex}

\fi

\begin{document}
\name{Someone}
\personalinfo{%
}

\begin{fullwidth}
\end{document}

• altacv is not a public class, so your example can not be tested (and it contains lots of \[ which would give errors anyway). Nov 28 '19 at 10:31
• @UlrikeFischer right, sorry. To be able to test it you would need : github.com/liantze/AltaCV/blob/master/altacv.cls Nov 28 '19 at 10:42
• There is this \ifxetexorluatex..\else..\fi-thingie with a lot of \usepackage in the else-branch. To me it seems maybe packages like hyperref, textpos, url, logreq and probably some others are needed also when running XeLaTeX but are not loaded as due to the \ifxetexorluatex..\else..\fi-thingie they are only loaded in case the TeX-engine running is based neither on XeTeX nor on LuaTeX. Nov 28 '19 at 11:01
• @UlrichDiez thanks, it worked :) Nov 28 '19 at 12:32

You need a \tagline command and should load hyperref

\documentclass[10pt,a4paper,normalphoto]{altacv}
\geometry{left=1cm,right=9cm,marginparwidth=6.8cm,marginparsep=1.2cm,top=1.25cm,bottom=1.25cm}
\usepackage{hyperref}
\begin{document}
\name{Someone}
\tagline{blub}
\begin{fullwidth}
\end{fullwidth}
\end{document}


Your sample document does not compile because

1. the fullwidth environment is not closed
2. A \tagline{} seems to be mandatory
3. You are not loading the hyperref package because it is in the \else part of \ifxetexorluatex.

Fixing all these things I get

\documentclass[10pt,a4paper,normalphoto]{altacv}
\geometry{left=1cm,right=9cm,marginparwidth=6.8cm,marginparsep=1.2cm,top=1.25cm,bottom=1.25cm}
\usepackage{hyperref}

\begin{document}
\name{Someone}
\personalinfo{%
}

\begin{fullwidth}

• I have removed the complete \ifxetexorluatex\else ... \fi, since you are using XeLaTeX.
• \ref is for internal references, not external ones. The two question marks indicate that there is no label http://facebook.com/ defined.