Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pdf bookmarks with hyperref and beamer

247 views
Skip to first unread message

epurdom

unread,
Feb 20, 2007, 1:35:47 PM2/20/07
to epu...@gmail.com
Hi,
I am using the beamer package to create a presentation and I want each
"frame" (slide) to have a bookmark in pdf, preferably hierarchically
placed under the section/subsection bookmark to which it belongs. I
don't know how to do this without also marking each frame as a
subsection and therefore having it show up in my outline at the
beginning of the presentation (this is what is allowed by emulation of
the prosper package within beamer). I also only want 1 bookmark per
frame -- not a bookmark repeated for each overlay in the frame.

Obviously, I would like this to happen automatically (i.e. from the
frametitle, create a pdf bookmark) and if anyone knows a macro that
does that, it would solve all my problems. But even if I manually must
include a \pdfbookmark command for every frame, I would like to know a
way to have the level and the target name generated automatically. In
otherwords, "level" should be 1 more than the current level of the
outline (so for any frames following a subsection label, then the
level should be 3+1=4, but if they follow only a section label then
the level should be 2+1=3) and "target" should be a unique name that
probably increases by some counter, but I'm not sure how to do it
correctly.

Thanks

Jellby

unread,
Feb 22, 2007, 12:27:08 PM2/22/07
to
Entre otras cosas, epurdom tuvo a bien escribir:

I did by changing this definition:

\long\def\beamer@@frametitle[#1]#2{%
\beamer@ifempty{#2}{}{%
%===== add from here =====
% note: I added the bookmark to the last slide of the frame, if you want
% it pointing to the first one, use \beamer@startpageofframe
\ifnum\c@page=\beamer@endpageofframe%
{\Hy@writebookmark{\the\c@framenumber}{#2}{Navigation\the\c@page}%
{10}{toc}%
\expandafter\@tempcnta\Hy@currentbookmarklevel%
\advance\@tempcnta by -1%
\xdef\Hy@currentbookmarklevel{\the\@tempcnta}}%
\fi%
%===== to here =====
\gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}%
\space\usebeamertemplate*{frametitle[continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}%


And maybe something else around. Let me know if works... or if it doesn't.

--
Ignacio __ Fernández Galván
/ /\
Linux user / / \ PGP Pub Key
#289967 / / /\ \ 0x01A95F99
/ / /\ \ \
http://djelibeibi.unex.es
/________\ \ \
jellby \___________\/ yahoo.com

epurdom

unread,
Feb 25, 2007, 4:28:00 PM2/25/07
to


Hi,
Thanks for the suggestion, but I tried that, and I got the error below
(many times). The result was that there were no new bookmarks and the
bookmarks created for the section/subsection etc. no longer had any
hierarchy

! Undefined control sequence.
<write> ...ncoding Graphs for Analysis}{\Parent-3
}
l.149 \section{Encoding Graphs for Analysis}

Jellby

unread,
Feb 26, 2007, 3:55:36 PM2/26/07
to
Among other things, epurdom saw fit to write:

> Thanks for the suggestion, but I tried that, and I got the error below
> (many times). The result was that there were no new bookmarks and the
> bookmarks created for the section/subsection etc. no longer had any
> hierarchy
>
> ! Undefined control sequence.
> <write> ...ncoding Graphs for Analysis}{\Parent-3
> }
> l.149 \section{Encoding Graphs for Analysis}

Well, there are several things. First: some typos in my code (a spurious "["
and a missing "}"). Second: you have to \setcounter{tocdepth}{10} in order
to have the frames appearing in the bookmarks. Third: indeed, it messes up
the structure if tocdepth is not 10, so I've added a test. But I couldn't
get your error.

Try this, it works for me:

%=========================================================
\documentclass{beamer}

\makeatletter


\long\def\beamer@@frametitle[#1]#2{%
\beamer@ifempty{#2}{}{%

\ifnum\c@page=\beamer@endpageofframe%
{\Hy@writebookmark{\the\c@framenumber}{#2}{Navigation\the\c@page}%
{10}{toc}%

\ifnum\c@tocdepth=10\relax%


\expandafter\@tempcnta\Hy@currentbookmarklevel%
\advance\@tempcnta by -1%
\xdef\Hy@currentbookmarklevel{\the\@tempcnta}%
\fi}%

\fi%


\gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}%
\space\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}%

}%
\makeatother

\setcounter{tocdepth}{10}
\listfiles

\begin{document}

\section{One}
\subsection{Two}
\begin{frame}\frametitle{Testing 1}\end{frame}
\begin{frame}\frametitle{Testing 2}\end{frame}
\subsection{Three}
\begin{frame}\frametitle{Testing 3}\end{frame}
\begin{frame}\frametitle{Testing 4}\end{frame}
\section{Four}
\subsection{Five}
\begin{frame}\frametitle{Testing 5}\end{frame}
\begin{frame}\frametitle{Testing 6}\end{frame}

\end{document}
%=========================================================

Some versions:
beamer.cls 2005/10/23
hyperref.sty 2003/11/30

epurdom

unread,
Feb 28, 2007, 7:51:39 PM2/28/07
to


The test example worked fine, but I got the same error when I actually
put it in my presentation, so there's probably some conflict that
I'll need to sort out. (I may have some \pdfbookmark commands
explicitly entered and perhaps that's a conflict?) Anyway, thanks for
the code!

0 new messages