The clickable area of the hyperlink does not surround the image.



Desired behavior:

I can achieve something similar by writing some text afterwards...

\href{https://github.com/}{\includegraphics[height=12pt]{img/github.png} github}

EDIT: Looks like it's a problem with xelatex. Cannot reproduce on pdflatex. Version info:

XeTeX  3.14159265-2.6-0.99998 (TeX Live 2017/Arch Linux)
pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017/Arch Linux)

Package: graphicx 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
Package: hyperref 2017/03/14 v6.85a Hypertext links for LaTeX
  • please (again), provide complete small document, which reproduce showed image. your code snippet, as you can see from my answer, works well with xelatex! – Zarko Feb 20 '18 at 8:25
  • @Zarko I used your example to test. Running xelatex experiment.tex produces this PDF. – Mateen Ulhaq Feb 20 '18 at 8:28
  • apparently your test is not equal to mine. try with example image, then see if your latex installation is up-to -date. as you can see, my result are as you like to have. – Zarko Feb 20 '18 at 8:35
  • I tried using the image you posted, but same result. I've edited in some versioning info above. – Mateen Ulhaq Feb 20 '18 at 8:46
  • 1
    recent hypperef is 2018/02/06 v6.86b. i use miktex, recent version with recent version of all packages. – Zarko Feb 20 '18 at 9:16

please always provide complete small document, which demonstrate your problem!

you have error in \includegraphics[height=12]{example-image-a} (observe missing units for height of image). for this you should received warnings: Illegal unit of measure ... . correct code is:



which gives:

enter image description here

tested with pdflatex as well with xelatex. results are the same.

| improve this answer | |
  • Sorry that was just a reproduction mistake. I did indeed use 12pt. – Mateen Ulhaq Feb 20 '18 at 7:55
  • than you shouldn't have any problems to obtain shoved result. if not, than you have something in your document, what you not show us. on such way is not possible to help you. – Zarko Feb 20 '18 at 7:59
  • Looks like it's a problem with xelatex. pdflatex works fine. – Mateen Ulhaq Feb 20 '18 at 7:59
  • 1
    even worse. how should i know this? i haven't telepathic ability :-(. anyway, see edited answer. i test with xelatex too and it works. – Zarko Feb 20 '18 at 8:00

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.