[pdftex] Strange parameter in hypersetup
Heiko Oberdiek
oberdiek at ruf.uni-freiburg.de
Tue Jun 12 14:45:40 CEST 2001
On Tue, 12 Jun 2001, Lutz Ihlenburg wrote:
> I would like to achieve that my PDF document opens with a certain page.
> \hypersetup{pdfstartpage = 33}
> functions well. However, it should not be #33 but the page, on which label VL6 is defined! Naively I wrote:
> pdfstartpage = {\pageref{VL6}}
I hope you have an uptodate hyperref. Then the following should work:
\documentclass{article}
% All has to be done, _after_ the .aux file with the labels
% is read and _before_ hyperref uses the value of pdfstartpage.
\AtBeginDocument{%
\begingroup
% initializise \StartPage with the first page
\gdef\StartPage{1}%
% local assignment of pageref value to counter value
\count0=\hypergetpageref{VL6}\relax
% if undefined, \hypergetpageref returns zero and
% prints a warning
\ifnum\count0>0 %
\xdef\StartPage{\the\count0}%
\fi
\endgroup
\hypersetup{pdfstartpage={\StartPage}}%
}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\newpage
\section{Hello World}
\newpage
\section{Foo Bar}\label{VL6}
\newpage
bla bla
\end{document}
Yours sincerely
Heiko <oberdiek at uni-freiburg.de>
More information about the pdftex
mailing list