GeneralImage as Hyperlink to URL

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
dorian
Posts: 2
Joined: Thu Oct 13, 2011 1:54 am

Image as Hyperlink to URL

Post by dorian »

Hi,

I would like to link an image, displayed within the figure environment to a web page. So one could click on the image in the PDF to visit a certain web page. So far, i couldn't figure out how to do this with the standard \href command.

Thanks for any help!

Dorian

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

5gon12eder
Posts: 126
Joined: Sun Feb 13, 2011 8:36 pm

Image as Hyperlink to URL

Post by 5gon12eder »

This should work without any problems. See the below example and the rendered output.

Code: Select all

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

\begin{document}
  
  \begin{figure}
    \href{http://commons.wikimedia.org/wiki/File:Pachydyptes_ponderosus.jpg}
         {\includegraphics[width=\textwidth]{picture}}
    \caption{A reconstruction of New Zealand Giant Penguins (\emph{pachydyptes ponderosus}) by 
      F.~W.~Kuhnert (1865--1926). Click on the image to visit the page on Wikimedia Commons where it 
      was downloaded from.}
  \end{figure}
  
\end{document}
Attachments
example.pdf
Rendered output of the above MWE. (The image has been shrunk drastically in order to meet the file size limitation.)
(169.77 KiB) Downloaded 2062 times
I'm using pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian).
dorian
Posts: 2
Joined: Thu Oct 13, 2011 1:54 am

Re: Image as Hyperlink to URL

Post by dorian »

Thank you, that makes sense and works perfectly well! Problem solved

thanks and have a nice day
dorian
Post Reply