LaTeX has a URL with a link in the hyperref package in the caption of the image, but in List of Figures it is linked to the diagram in PDF and not to https://google.com
. I'd like to link it to the latter. Is there any good way?
\ documentclass [a4j, freqn, dvipdfmx] {jarticle}
\uspackage [dvipdfmx] {graphicx}
\uspackage {hyperref}
\hypersetup {colorlinks=true}
\begin { document }
\begin {figure}
\includegraphics {image.jpg}
\caption{image is from \url{https://google.com}}
\end {figure}
\listofffigures
\end { document }
If you only want the URL portion of the caption in the table of contents to function as an external link, you can do so by loading the hyperref package with the linktoc=none
option.
\uspackage [linktoc=none] {hyperref}
This disables hyperref's ability to "make each item in the table of contents an internal link that jumps to that item" (enabled by default), and allows the image to get the same output as the one written from \url {https://google.com} to .
In other words, LuaLaTeX supports nesting of hyperlinks, and it seems that "all items in the table of contents are internal links to the relevant parts, and only the links in the items are external links."
%#!lualatex
\ documentclass [a4j,fleqn] {ltjarticle}
\uspackage {graphicx}
\uspackage {hyperref}
\hypersetup {colorlinks=true}
\begin { document }
\begin {figure}
\includegraphics {example-image-a}
\caption{image is from \url{https://google.com}}
\end {figure}
\listofffigures
\end { document }
© 2024 OneMinuteCode. All rights reserved.