I'm stumped by an error I'm getting, when I try to render a Tufte-LaTeX document using hypcap
and hyperref
. For example, even a minimal document consisting of
\documentclass[nohyper]{tufte-handout}
\makeatletter
\let\tufte@caption\@caption % Protect caption from hyperref
\RequirePackage{hyperref}
\let\@caption\tufte@caption % See -- http://tex.stackexchange.com/a/46838
\makeatother
\RequirePackage[all]{hypcap} % See -- http://tex.stackexchange.com/a/27349
\begin{document}
\begin{figure}\caption{An empty figure.}\end{figure}
\end{document}
causes an error:
Package hypcap Error: You have forgotten to use \caption.
What is causing this error, and how can I avoid it?
If it comes to it, I'd settle for giving up some features provided by either hypcap
of hyperref
(e.g., linking to figures) if that's what it takes to keep things stable. I don't want to give up the visible effects of the Tufte style.
hypcap
is upset about\caption
not being defined as expected.hypcap
not work with Tufte at all then? Or hashyperref
done something?hypcap
uses the interface ofhyperref
located in the definition of\@caption
patched byhyperref
, sohypcap
is dependent on this redefinition. But your code prevents the redefinition of\@caption
by thehyperref
package and therefore thehypcap
package is doomed to fail. Remedy: Do not suppress the redefinition of\@caption
but offer a new definition of\@caption
which works with both,tufte
andhyperref
. (Unfortunately I'm too short on time at the moment to code this for you, but I'm confident that someone here will...)\@caption
done by thehyperref
package)\@caption
here. I could do that, but will not able to code it until week-end.