1

I have seen questions like this and this but I think my question is different because it is in an RTL environment and uses non-Roman script.

I have a url that appears mixed-script in the address bar of my Chrome browser. When I copy/paste the URL from the address bar of my browser it converts the non-ascii characters. And hyperref is happy.

https://ar.wikisource.org/wiki/%D8%A5%D9%86%D9%88%D9%85%D8%A7_%D8%A5%D9%84%D9%8A%D8%B4

But in my pdf I want to give the label of the URL the appearance of a mixed-script URL, just as it appears in the browser. So the label of the URL in hyperreff needs to contain both Roman and Arabic characters. I don't know how to get this to work. The commented-out lines in the script below tell roughly what I want, but when they are included it produces errors, understandably.

Here is my MWE:

\documentclass{article}
\usepackage{polyglossia}
\usepackage{hyperref}
\setmainlanguage{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont[Script=Arabic]{Scheherazade}
\let\arabicfonttt\ttfamily

\begin{document}
\href{https://ar.wikisource.org/wiki/%D8%A5%D9%86%D9%88%D9%85%D8%A7_%D8%A5%D9%84%D9%8A%D8%B4}{test}

% attempt 1
% \href{https://ar.wikisource.org/wiki/%D8%A5%D9%86%D9%88%D9%85%D8%A7_%D8%A5%D9%84%D9%8A%D8%B4}{إنوما_إليش}

% attempt 2
% \href{https://ar.wikisource.org/wiki/%D8%A5%D9%86%D9%88%D9%85%D8%A7_%D8%A5%D9%84%D9%8A%D8%B4}{\textarabic{إنوما_إليش}}

\end{document}
Tim
  • 1,539

1 Answers1

1

You have an underscore (_) in your hyperlink name, which is generating the error. You probably missed it because your editor thinks it's part of a comment. You just need to escape it: \_

Try this:

\documentclass{article}
\usepackage{polyglossia}
\usepackage{hyperref}
\setmainlanguage{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont[Script=Arabic]{Scheherazade}
\let\arabicfonttt\ttfamily
\begin{document}
\href{https://ar.wikisource.org/wiki/%D8%A5%D9%86%D9%88%D9%85%D8%A7_%D8%A5%D9%84%D9%8A%D8%B4}{إنوما\_إليش}
\end{document}
David Purton
  • 25,884