I've defined a different color for hyperlink using \hypersetup
command with urlcolor
. When I am compiling it with XeLaTeX I am getting undefined color
error for the URL link, but it works fine when I compile with LaTeX (the color of the link changes). Similar error have been discussed before here and here, but my problem seems to be a bit different. Below is a simplified example of code I am trying to compile:
\documentclass[10pt, a5paper]{article}
\usepackage{fontspec}
\PassOptionsToPackage{pdftex,usenames,dvipsnames}{color}
\usepackage[bookmarks, colorlinks, breaklinks]{hyperref}
\hypersetup{linkcolor=blue,citecolor=blue,filecolor=black,urlcolor=MidnightBlue}
\begin{document}
\begin{center}
\href{https://tex.stackexchange.com/}{https://tex.stackexchange.com/}
\end{center}
\end{document}
Best Answer
You would also receive a host of other errors. Here it is best to use
rather than "passing the options to the package". Since you're processing your file under
xelatex
anyway, I've dropped the driver supportpdftex
. By default I usexcolor
, although you could also usecolor
.