12

I'm trying to write a hyperlink for a DjVu document that includes Latin accent, but for some reason, it only displays properly for the PDF one. Specifically, on my list of references (bibliography), I have

\hyperref{http://www.something.com/camión/ }{link}.

It does not work: neither by replacing the letter ó by its Unicode \unichar{243} nor by its mathematical accent \acute{o}... Furthermore "copy-paste" of the glyph (ó) in the LaTEX word processor produces almost the same result, i.e., the above hyperlink in

  1. PDF document, leads to the website

    http://wwwu.something.com/camión/
    
  2. DJVU document, leads to the website

    http://www.something.com/cami"strange symbol"n/
    

Please, can you suggest me a way of solving this problem?

1
17

You can use the UTF-8 (hex.) representation:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}

\begin{document}

\href{http://www.something.com/cami\%C3\%B3n/ }{link}

\end{document}

A site with a table to look up characters: http://www.utf8-chartable.de/

As Heiko Oberdiek mentions in his comment, the browser might help to get the correct encoded URL: you can copy&paste from the address bar or use the "Copy Link Address" facility.

2
  • 3
    The browser might help to get the correct encoded URL: Copy&page from the address bar or 'copy link location'. – Heiko Oberdiek Aug 1 '12 at 2:08
  • @HeikoOberdiek Thank you. I've added these options to my answer. – Gonzalo Medina Aug 1 '12 at 2:47
1

Here is an easy way to have the esoteric url encoding with Python 3.

import urllib.parse

print(
    urllib.parse.quote(
        "http://www.something.com/camión/", 
        safe = "/:"
    ).replace('%','\%')
)

This will give you.

http://www.something.com/cami\%C3\%B3n/
1
  • Gonzalo Medina: It happens, that it works well for both situations, in PDF and DjVu viewers. – user17133 Aug 1 '12 at 14:53
0

adding the following packages worked for me:

 \usepackage[utf8]{inputenc}
 \usepackage[]{hyperref}
 \usepackage[T1]{fontenc} 
 \usepackage{lmodern}

Example:

\documentclass{article}
\usepackage[utf8]{inputenc} %Attention here!
\usepackage[]{hyperref} %Attention here!
\usepackage[T1]{fontenc} %Attention here!
\usepackage{lmodern} %Attention here!

\title{Accents}
\author{#CLoezaOficial}
\date{November 2020}

\begin{document}

\maketitle
\section{Accents}
\url{https://es.wikipedia.org/wiki/Archivo:Planos_anatómicos.svg} %Attention here!

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy