# Is there a way to delay the setting of hyperref hypersetup values?

I have a situation where the document title is set later, wrapped in another command (it has to do with language versions).

I would like to put the new title into the hypersetup pdftitle command. The result is not desired. The file's metadata shows up in Adobe Reader as Baluga. It does not seem to matter whether I put the \hypersetup below my specialmacro or not.

# Example

\documentclass{article}
\usepackage{fontspec}
\usepackage{hyperref}
\newcommand\baluga{Baluga}
\newcommand\whale{}
\hypersetup{%
pdftitle={\baluga{} \whale{}},%
}%
\newcommand\specialmacro{
\renewcommand\whale{whale}
}
\begin{document}
\specialmacro{}

Test

\end{document}


# Update: Solution using Wrapper for \hypersetup

\documentclass{article}
\usepackage{fontspec}
\usepackage{hyperref}
\newcommand\baluga{Baluga}
\newcommand\whale{}
\newcommand\hyperset{
\hypersetup{%
pdftitle={\baluga{} \whale{}},%
}%
}
\newcommand\specialmacro{
\renewcommand\whale{whale}
\hyperset
}
\begin{document}
\specialmacro{}

Test

\end{document}


Here is the new edited version:

\documentclass{article}
\usepackage{fontspec}
\usepackage{hyperref}
\newcommand\baluga{Baluga}
\newcommand\whale{}

\newcommand\hyperset{\hypersetup{pdftitle={\baluga{} \whale{}},}}

\begin{document}
Test
\renewcommand\whale{whale}
\hyperset
\end{document}

• I am sorry, but that does not answer the question, "Is there a way to post-process setting the hyperref hypersetup values?" I appreciate the effort anyway. Apr 23 '15 at 10:44
• perhaps \hypersetup command can be called just before the \end{document}. That would post-process the settings. Apr 23 '15 at 10:47
• That is in interesting idea. I will try wrapping \hypersetupin a macro and calling it in the \specialmacro after the title is set. Apr 23 '15 at 10:48
• You may also use \AtEndDocument{\hypersetup{...}} in the preamble so avoiding the need of typing it manually. Apr 23 '15 at 11:52