# What is the side effect when hyperref has stopped early?

\documentclass{beamer}
\usepackage{lmodern}
\usepackage{caption}
\begin{document}
\begin{frame}{Are you kidding?}
No! I am not a good joker.
\end{frame}
\end{document}


The following is taken from Ulrike's comment:

beamer loads hyperref with the option implicit=false. This option inserts a \endinput in the command \MaybeStopEarly in hyperref and has the effect that about 2000 lines of code of hyperref are not executed. This 2000 lines contains a lot of definitions and redefinitions. One of them is e.g. that it inserts in \@caption the command \hyper@makecurrent{\@captype}. So getting rid of the warning by giving \hyper@makecurrent and empty definition will quite probably not enable hyperref support.

The next question becomes: Why does beamer load incompletely hyperref? What is the purpose?

-
@xport I am not kidding remove \usepackage{caption}:). – Yiannis Lazarides Jun 18 '11 at 20:04
@xport: There's no need to use captions in a presentation. – egreg Jun 18 '11 at 20:13
@egreg: Yes, but it is very special case, I have to present how to use LaTeX to the audience. The presentation must contain LTXexample environment with many other LaTeX environments inside. One of the topics is about caption. – xport Jun 18 '11 at 20:18
@xport: Import your example as a PDF file – egreg Jun 18 '11 at 20:26
@xport use \documentclass[final]{beamer} and it should fix it, seriously:) – Yiannis Lazarides Jun 18 '11 at 20:54

Looking at the caption package documentation, these are the lines which are responsible for the warning:

\caption@IfPackageLoaded{hyperref}[2003/11/30 v6.74m]{%
\@ifundefined{hyper@makecurrent}{% hyperref has stopped early
\caption@WarningNoLine{%
Hyperref support is turned off\MessageBreak
because hyperref has stopped early}%
}{%


Thus, the warning is produced because the hyperref package is not loaded completely when using the beamer document class.

So if you really need to use the caption package and want to get rid of the warning, you could add the following lines

\makeatletter
\newcommand\hyper@makecurrent[1]{}
\makeatother


before loading the caption package.

-
@xport: the warning produced by loading caption indicates that caption turns off its hyperef support; on the other side, hyperref is not loaded completely and it emits the message Hyperref stopped early (you can see it in the .log file) independently of loading or not caption. The message issued by hyperref is a simple \typeout, not a warning, so I think there's not any negative effects added. – Gonzalo Medina Jun 18 '11 at 23:08
beamer loads hyperref with the option implicit=false. This option inserts a \endinput in the command \MaybeStopEarly in hyperref and has the effect that about 2000 lines of code of hyperref are not executed. This 2000 lines contains a lot of definitions and redefinitions. One of them is e.g. that it inserts in \@caption the command \hyper@makecurrent{\@captype}. So getting rid of the warning by giving \hyper@makecurrent and empty definition will quite probably not enable hyperref support. – Ulrike Fischer Jun 20 '11 at 9:23
Beside this: \hyper@makecurrent is used in the false branch of the test in caption. So if you really want to lie to caption you should at least give it the right number of arguments \newcommand\hyper@makecurrent[1]{} – Ulrike Fischer Jun 20 '11 at 9:24
I cancel the green mark because you are not sure whether or not this issue has negative effects. – xport Jun 20 '11 at 17:48
This is exactly the kind of "help" that makes package authors scream - because if then somehow caption breaks and you contact the author of caption, you are out of luck. Beamer + hyperref + caption doesn't work. Get used to it. – Martin Schröder Jul 7 '11 at 14:12