Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am attempting to use an \urldef defined URL to print as a clickable link. But it's resulting in an error.

So far I have this:

\documentclass{article}
\usepackage{hyperref} 
\usepackage{url}
\urlstyle{sf}
    \urldef{\myurl}\url{http://wam.org.ae/servlet/Satellite?c=WamLocAnewscid=1289997634568&p=1135099400289&pagename=WAM%2FWamLocAnews%2FW-T-LAN-FullNews}
\begin{document}
\myurl
\end{document}

The last lines of the error read

! Undefined control sequence.
\hyper@linkurl ...n/S/URI/URI(#2)>>}\Hy@colorlink 
                                              {\@urlcolor }#1\close@pdfl...
l.5 ...ename=WAM%2FWamLocAnews%2FW-T-LAN-FullNews}

If anyone can give me some pointers or examples on how I can get it to work, that would be great.

---EDIT----

I understand @egreg's answer should work after I update my TeX installation.

... (later) ...

It did solve it. So if you get the error reported above, you probably have a very old version that needs updating.

share|improve this question
    
Do you need to display the website URL in the text, or just have a clickable link to the website with some other text? –  Werner Feb 24 '12 at 21:32
2  
Just say \myurl if you want a link showing all of the URL. –  egreg Feb 24 '12 at 21:42
    
It seems \href does not work with \urldef - the problem is not caused by the special characters in your url. –  Martin Schröder Feb 24 '12 at 21:46
    
@Werner I want to display the full URL as a clickable link to the same URL. –  user12083 Feb 24 '12 at 21:54
    
@MartinSchröder Yes, I expected that this is where the problem lies. Can you suggest an alternative approach to end up with a clickable URL with special charcaters? –  user12083 Feb 24 '12 at 21:57
show 6 more comments

closed as too localized by Thorsten, lockstep, Joseph Wright Feb 25 '12 at 9:42

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.