3

I am using pdflatex.

The following creates a live link the the first URL ("mousse" with no French accent). When I click on it in the PDF, I am brought to that page. The second URL (containing two acute French accents) looks right in the PDF but the link is dead.

When I use latex and dvipdfm, two live links are created but they do not bring me to the proper place.

How can I get live URLs in my PDF, when the URLs contain European accented characters?

\documentclass[11pt]{article}
\usepackage{url}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\begin{document}

This creates a live link in the PDF:

\url{http://www.larousse.fr/dictionnaires/francais-anglais/mousse/52833}

The following looks all right in the PDF but is a dead link:

\url{http://www.larousse.fr/dictionnaires/francais-anglais/écrémer/27576?q=écrémé}
\end{document}
1
  • The start of my log file says: This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011/Fink) Commented Sep 11, 2013 at 0:49

3 Answers 3

7

The URL should be percent encoded:

\href{http://www.larousse.fr/dictionnaires/francais-anglais/%C3%A9cr%C3%A9mer/27576?q=%C3%A9cr%C3%A9m%C3%A9}{%
  \nolinkurl{http://www.larousse.fr/dictionnaires/francais-anglais/écrémer/27576?q=écrémé}}

Copying and pasting the URL from the location bar of the browser (firefox, ...) usually gets the percent encoded version of the URL.

2
4

You can also use \url{} and escape the percentage symbols with a backslash. Maybe not as clean as the other answer but I couldn't make it work as explained so I used this approach and it worked.

As an example, for the url http://es.wikipedia.org/wiki/Problema_de_satisfacci%C3%B3n_de_restricciones, the code would be this:

\url{http://es.wikipedia.org/wiki/Problema_de_satisfacci\%C3\%B3n_de_restricciones}
2
  • 1
    Why would you escape the percentage symbols? The result would print with the backslashes, which doesn't yield the correct web address anymore.
    – Werner
    Commented Apr 22, 2014 at 19:29
  • 1
    @Werner: It's a feature of hyperref. Otherwise it would be a little difficult to specify the percent character (comment character in TeX) in URLs, if \url or \href are used inside \footnote{...} or other commands. Commented Apr 22, 2014 at 19:57
0

Given that I spent too much time figuring this out I will post this as an answer. I needed to combine the ideas in the two answers above.

The source code snippet

\begin{center}
\href{https://fi.wikipedia.org/wiki/Andr\%C3\%A9_Weil}
{\nolinkurl{https://fi.wikipedia.org/wiki/André_Weil}}
\end{center}

produced a link in the pdf-document that actually points at the desired url as well as prints the url as it is seen in the browser rather than in unicode.

So

  • use the \href{...}{\nolinkurl{...}} construct from Heiko's answer, and
  • remember to escape the % characters in the copy/pasted url as explained by aldr0.

You must log in to answer this question.

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