Graphics, Figures & TablesSubfloat references broken by hyperref's implicit=false

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
woj-k
Posts: 15
Joined: Wed Jul 28, 2010 7:25 pm

Subfloat references broken by hyperref's implicit=false

Post by woj-k »

Hello all,

I am using the subcaption package with hyperref. If I allow hyperref to redefine LaTeX internals (implicit option set to true), everything works fine. If, however, I do not want a hyperlinked document and set hyperref's implicit=false option, subcaption's \subref macro generates errors. Problem exists both in pdfLaTeX and XeLaTeX. The \ref macro is unaffected.

The obvious answer is "don't want hyperlinks -> don't use hyperref", but the problem is, hyperref's rich options are also good for other things, like controlling pdf metadata using the \hypersetup{pdfinfo={...}}.

I found some old topics from 2011--2012 that dealt with hyperref--subcaption issues that were patched shortly thereafter, but it seems only behaviour with the default implicit=true was addressed.

Does anyone have an idea how to make \usepackage[implicit=false]{hyperref} work with subcaption's facilities? I would greatly appreciate any advice.

MWE:

Code: Select all

\documentclass[final,a4paper]{article}

\usepackage{caption}
\usepackage[position=below]{subcaption}
\usepackage[final,implicit=false]{hyperref}

\begin{document}
Reference to Table: \ref{tab:one}

Reference to first subtable: \ref{subtab:one}

Subreference to first subtable: \subref{subtab:one}% Error if implicit=false, works otherwise.

\begin{table}\centering
\caption{Table caption 1}\label{tab:one}
\subcaptionbox{\strut\label{subtab:one}}{First subfloat}

\bigskip

\subcaptionbox{\strut\label{subtab:two}}{Second subfloat}
\end{table}

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
Post Reply