latex clickable The whole image

Viewed 123

in HTML, we can have a clickable image like this :

<!DOCTYPE html>
<html>
    <head>
        <title>HTML Image as link</title>
    </head>
    <body>
        <a href="https://www.google.com"><img src="https://www.w3schools.com/html/pic_trulli.jpg"></a>
    </body>
</html>

you can click everywhere and you redirect to the website .also in LaTeX, we can have a clickable image like this

\documentclass[10pt,a4paper]{article}
\usepackage{hyperref,graphicx}
\begin{document}
    \href{http://www.blog.com}{\includegraphics{blog}}
\end{document}

but the problem is The whole image is not clickable,there is a small point left-hand side it is very small.

i want the image can be clickable like fonts and text all-over the image

\href{http://www.blog.com}{Hello}
\Huge\href{http://www.blog.com}{\faGithub}

my editor is : TeXstudio 4.1.2 (git n/a) Using Qt Version 5.12.8, compiled with Qt 5.12.8 R

latex compiler is : XeLaTeX

thanks

1 Answers

xelatex does not support non-text hyperlinks. The easiest solution is to use another engine. For example lualatex can do pretty much everything that xelatex can do.

(For the odd case in which changing the engine is not an option, there are workaround for to make non-text elements clickable, see e.g. https://github.com/josephwright/beamer/issues/332#issuecomment-774659976 )

Related