I'm proofreading a large manuscript and to make document navigation easier I'm trying to add pdf bookmarks to the MS using hyperref. But when I add this command:
\usepackage[bookmarks=true,%
bookmarksopen=true,%
bookmarksnumbered=true,%
colorlinks=true,%
linkcolor=blue]{hyperref}
to the document preamble, I get this error:
! Use of \caption@@setkeys doesn't match its definition.
\text@command #1->\def \reserved@a {
#1}\ifx \reserved@a \@empty \let \check@...
l.10768 \subfloat
{
Does anyone have any suggestions?
General ⇒ hyperref causing problems with \subfloat
NEW: TikZ book now 40% off at Amazon.com for a short time.

hyperref causing problems with \subfloat
Can you please post a minimal working example showing the undesired behaviour?
1,1,2,3,5,8,13,21,34,55,89,144,233,...
hyperref causing problems with \subfloat
Ok, here it is:
The problem disappears if I comment out the command
\renewcommand{\thefigure}{\thesubsection\textit{\@alph\c@figure}}
But what if I don't want to do that?
\documentclass[a4paper]{lloydbook}
\usepackage[bookmarks=true,%
bookmarksopen=true,%
bookmarksnumbered=true,%
colorlinks=true,%
linkcolor=blue]{hyperref}
\usepackage{subfig}
\makeatletter
\renewcommand{\thesubsection}{\thesection\@arabic\c@subsection}
\renewcommand{\thefigure}{\thesubsection\textit{\@alph\c@figure}}
\makeatother
\begin{document}
\begin{figure}[htbp]
\begin{center}
\subfloat{
\begin{tabular}[t]{r|ccc}
$\land$ & 1 & 2 & 3\\\hline
*1 & 1 & 2 & 3\\
2 & 2 & 2 & 3\\
3 & 3 & 3 & 3\\
\end{tabular}
}
\end{center}
\caption{{\L}ukasiewicz's 3-Valued Tables}
\label{orig_fig_2.11a}
\end{figure}
\end{document}
The problem disappears if I comment out the command
\renewcommand{\thefigure}{\thesubsection\textit{\@alph\c@figure}}
But what if I don't want to do that?
hyperref causing problems with \subfloat
My apologies, I didn't provide the style file lloydbook.cls. But the problem is replicable with the standard book class.Zardoz wrote:Ok, here it is:\documentclass[a4paper]{lloydbook}
hyperref causing problems with \subfloat
The subfig package defines \theHsubfigure (the command which hyperref uses to build anchor names for sub-figures) in an "unlucky" way, because this definition is based upon \thefigure instead of \theHfigure. Since you change \thefigure, you have to adapt \theHsubfigure, too, to get rid of this dependency.
Just add
*AFTER* \begin{document}.
(An alternative would be using the subcaption package instead of the subfig package, which hopefully has no problems with hyperref: http://www.ctan.org/tex-archive/macros/ ... b/caption/ . The very recent version 1.0 has also a \subfloat command inside which emulates the \subfloat command of the subfig package.)
Just add
Code: Select all
\renewcommand\theHsubfigure{\theHfigure.\arabic{subfigure}}
(An alternative would be using the subcaption package instead of the subfig package, which hopefully has no problems with hyperref: http://www.ctan.org/tex-archive/macros/ ... b/caption/ . The very recent version 1.0 has also a \subfloat command inside which emulates the \subfloat command of the subfig package.)