Hyperlink not surrounding figure

Hyperlink not surrounding figure

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

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

Produces:

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

답변1

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:

\documentclass{article}
\usepackage{graphicx}
\usepackage{hyperref}

\begin{document}
\href{https://github.com/}{\includegraphics[height=12pt]{example-image-a}}
\end{document}

which gives:

enter image description here

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

관련 정보