Document ClassesDisable hypertext links in hyperref!?

Information and discussion about specific document classes and how to create your own document classes.
wheely_chairs
Posts: 26
Joined: Mon Jun 16, 2008 1:22 pm

Disable hypertext links in hyperref!?

Post by wheely_chairs »

Is there a way to disable hypertext links in a document that uses the hyperref package? Or alternatively disable linking from just the TOC/LOF/LOT? I know this seems a little extreme as the package was designed to do exactly that but I have good reason:
- Subfigure links in the LOF are broken (i.e. they just point at the first page). I have been unable to reproduce this behavious in an MWE so I'm rather stumped. But links to subfigures in the main document still work.
- If it doesn't all work (the linking that is) then I'd rather not have it at all
- hyperref is still useful for defining properties of the pdf (author, title, etc) as well as adding bookmarks (which are still great ways to navigate a document)

So I'd just like to retain the bookmarking and document properties basically (and possibly non-TOC/LOF/LOT links). Any ideas?

Thanks,

Chris

Recommended reading 2024:

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

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

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Disable hypertext links in hyperref!?

Post by gmedina »

Have you tried the obvious first attempt: reading the hyperref documentation?
1,1,2,3,5,8,13,21,34,55,89,144,233,...
wheely_chairs
Posts: 26
Joined: Mon Jun 16, 2008 1:22 pm

Re: Disable hypertext links in hyperref!?

Post by wheely_chairs »

Yeah I forgot to mention that. I have read the documentation cover-to-cover but not spotted an answer...
wheely_chairs
Posts: 26
Joined: Mon Jun 16, 2008 1:22 pm

Disable hypertext links in hyperref!?

Post by wheely_chairs »

wheely_chairs wrote:Subfigure links in the LOF are broken (i.e. they just point at the first page). I have been unable to reproduce this behavious in an MWE so I'm rather stumped. But links to subfigures in the main document still work.
Ok so I've now identified the cause of this problem and created an MWE:

Code: Select all

Code, edit and compile here:
\documentclass[12pt, titlepage]{report}
\usepackage{subfig}
\setcounter{lofdepth}{2}
\usepackage[pdftex]{hyperref}
%%%%%%%% Document %%%%%%%%
\begin{document}
\listoffigures
\newpage
%\chapter{My First Chapter}
\begin{figure}
\subfloat[Subfigure 1 LoF entry][Subfigure 1 Caption]{
\makebox[0.45\textwidth]{\framebox[0.45\textwidth]{\rule{0pt}{0.45\textwidth}}}
\label{subfigure1}
}
\hspace{0.1\textwidth}
\subfloat[Subfigure 2 LoF entry][Subfigure 2 Caption]{
\makebox[0.45\textwidth]{\framebox[0.45\textwidth]{\rule{0pt}{0.45\textwidth}}}
\label{subfigure2}
}
\caption[Short caption for LoF]{Really long caption for entire figure}
\label{figure1}
\end{figure}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
With this code the List of Figures (LoF) is fine. However, if you uncomment the line

Code: Select all

%\chapter{My First Chapter}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Then the code/LoF breaks! I didn't expect it to be a chapter command causing hyperref to break! I hence get the following error in the log:

Code: Select all

pdfTeX warning (dest): name{figure.1.1} has been referenced but does not exist, replaced by a fixed one
pdfTeX warning (dest): name{chapter.1} has been referenced but does not exist, replaced by a fixed one
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Anyone have any suggestions? Aside from removing all the chapter commands!

Chris
wheely_chairs
Posts: 26
Joined: Mon Jun 16, 2008 1:22 pm

Re: Disable hypertext links in hyperref!?

Post by wheely_chairs »

And I just installed the latest version of hyperref (6.77u) but it hasn't made any difference...
User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Disable hypertext links in hyperref!?

Post by Stefan Kottwitz »

Hi Chris,

at least it will work if the figures are not counted by chapter, try:

Code: Select all

\usepackage{chngcntr}
\counterwithout{figure}{chapter}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Stefan
LaTeX.org admin
wheely_chairs
Posts: 26
Joined: Mon Jun 16, 2008 1:22 pm

Re: Disable hypertext links in hyperref!?

Post by wheely_chairs »

Thanks Stefan,

I'm not sure that numbering figures in this way is as elegant but at least it fixes my problem (beggers can't be choosers)!! I'm sure I did read somewhere that hyperref breaks when you redefine counters or some such... is that something like what this package does? (Many aspects of LaTeX are still Greek to me, lol!)

Thanks again,

Chris
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Disable hypertext links in hyperref!?

Post by gmedina »

Hi wheely_chairs,
wheely_chairs wrote:(beggers can't be choosers)!!
Yes, they can.

Your problem admits a better solution. Use the subcaption package (documentation here) instead of subfig. The little but powerful subcaption package comes as a complement to the caption package (English documentation here). Refer to the documentations for further information.

Code: Select all

Code, edit and compile here:
\documentclass[12pt,titlepage]{report}
\usepackage{caption}
\usepackage[list=true]{subcaption}
\usepackage[pdftex]{hyperref}
\begin{document}
\listoffigures
\newpage
\chapter{My First Chapter}
\begin{figure}
\begin{subfigure}[b]{.5\linewidth}
\centering
\rule{3cm}{2cm}
\caption[Subfigure LoF entry]{A subfigure}
\label{fig:1a}
\end{subfigure}%
\begin{subfigure}[b]{.5\linewidth}
\centering
\rule{3cm}{2cm}
\caption[Subfigure LoF entry]{Another subfigure}
\label{fig:1b}
\end{subfigure}
\caption[Figure LoF entry]{A figure with a really long caption}
\label{fig:1}
\end{figure}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Besides solving the problem with hyperref, the syntax of the new subfigure and subtable environments is more "natural", in the sense that it is analogous to that of the standard figure and table environments.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
wheely_chairs
Posts: 26
Joined: Mon Jun 16, 2008 1:22 pm

Re: Disable hypertext links in hyperref!?

Post by wheely_chairs »

Thanks for your reply gmedina. However, I know I'm being stupid, but how do I get the subcaption package!? I'm using TeXShop with TeXLive-2007 on a Mac (OS X 10.5).

Thanks,

Chris
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Disable hypertext links in hyperref!?

Post by localghost »

wheely_chairs wrote:[...] However, I know I'm being stupid, but how do I get the subcaption package!? [...]
Since Version 3.1 this package is a part of caption and represents some kind of replacement for subfig, which seems not to be maintained anymore. It has its own documentation where you can find useful information.


Best regards
Thorsten¹
Post Reply