# hyperref with implicit=false gives a warning

I am getting the following warning when I use beamer

Package hyperref Warning: Option pdftitle' has already been used

I can recreate the problem with the following MWE based on the article class

\documentclass{article}
\usepackage[implicit=false]{hyperref}
\AtBeginDocument{\hypersetup{pdftitle=mytitle}}
\begin{document}
Hello world
\end{document}


For reasons that are beyond my understanding (and beyond my desire to know) beamer requires hyperref to be loaded with implicit=false. The \AtBeginDocument{\hypersetup{pdftitle=mytitle}} occurs in a package written by me. Given that I need to load hyperref with implicit=false and I need to set pdftitle after I load hyperref, is there a way to avoid this warning (without using the silence package)? Yes, I know it is only a warning and doesn't really matter.

\documentclass{article}
\AtBeginDocument{\hypersetup{pdftitle=mytitle}}
\AtBeginDocument{\hypersetup{pdftitle=mytitle}}
\usepackage[implicit=false]{hyperref}
\begin{document}
Hello world
\end{document}


doesn't give the warning even though pdftitle is given twice.

The setting of option pdftitle is used in \PDF@FinishDoc. Usually it is called at the output of the first page, but with option implicit it is done via \AtBeginDocument.

Thus, either you can use your call of \AtBeginDocument before package hyperref is loaded, or package etoolbox helps with hook \AtEndPreamble:

\documentclass{article}
\usepackage[implicit=false]{hyperref}
\usepackage{etoolbox}
\AtEndPreamble{\hypersetup{pdftitle=mytitle}}
\begin{document}
Hello world
\end{document}


A little more digging and I think I have an answer. The issue is that implicit causes \PDF@FinishDoc to run earlier than usual. The default behavior of \PDF@FinishDoc is to disable the ability of \hypersetup to set pdftitle and instead cause it to produce a warning. A simple work around is to use \pdfinfo{/Title (mytitle)} instead of \hypersetup{pdftitle=mytitle}. My guess is that this has some drawbacks, but I don't know what they are yet. Another possibility is to redefine \PDF@FinishDoc so it runs later. I am hesitant to make it run later, since my guess is that there is a reason for it to run earlier with implicit. It might also be possible to either prevent pdftitle from being disabled, or to re-enable pdftitle, set it, and then disable it again.

I realize this is an old question, but I wanted to add that with the new lthooks it's possible to override beamer's setting 'implicit' to 'OFF':

\AddToHook{ package/before/hyperref }
{
\PassOptionsToPackage{ implicit = true }{ hyperref }
}


This will add implicit=true to the end of the options passed to hyperref. This doesn't cause me any problems for my use of beamer`, but due to lack of documentation I'm not entirely sure what this really does.

• "The implicit option determines whether hyperref redefines LaTeX internals. For beamer, we have a lot of manual redefinitions, so that is not appropriate. This is not documented in the beamer manual as it's essentially a technical aspect for developers: how beamer/hyperref work together." github.com/josephwright/beamer/issues/658 Mar 4, 2021 at 8:01