5

I use a template for beamer that redefines the block environment to make a real shadow, outline and custom bend corners. The look of it is quite nice but unfortunatly comes with the side effect of an incorrect position of the hyperref links inside the block environment. I would like to leave the template pretty much as it is and correct the link positions, if this is possible.

The position of the links are too high, which seems to be caused by the vertical offset introduced here that only effects the text but not the link:

\pgfputat{\pgfpoint{0pt}{-3ex}}{\pgftext[left,base]{\copy\bmb@bodybox}}

MWE

\documentclass{beamer}
\usepackage[backref=true, backend=biber]{biblatex}
\bibliography{biblatex-examples}
\usepackage{tikz}
\setbeamertemplate{blocks}[rounded]

\makeatletter
\newbox\bmb@headbox
\newbox\bmb@bodybox

\renewcommand\beamerboxesrounded[2][]{%
  \setkeys{beamerboxes}{upper=block title,lower=block body,width=\textwidth}%
  \setbox\bmb@headbox=\hbox{%
    \begin{minipage}[b]{\bmb@width}%
      #2%
    \end{minipage}}%
  \setbox\bmb@bodybox=\hbox\bgroup\begin{minipage}[b]{\bmb@width}%
}

\def\endbeamerboxesrounded{%
  \end{minipage}\egroup%
  \begin{tikzpicture}
    \pgfputat{\pgfpoint{0pt}{0pt}}{\pgftext[left,base]{\copy\bmb@headbox}}
    \pgfputat{\pgfpoint{0pt}{-3ex}}{\pgftext[left,base]{\copy\bmb@bodybox}}
  \end{tikzpicture}
}
\makeatother

\begin{document}
\begin{frame}
\begin{block}{This is the block title}
This is where the citation occurs \cite{kastenholz}
\end{block}
\end{frame}
\end{document}
maetra
  • 4,540
  • How come when I compile your MWE, I don't receive a rounded box? Is biblatex really needed in this MWE? Same goes for the citation. – Werner Nov 07 '12 at 06:24
  • @Werner According to the beamer manual: "The hyperref package is automatically loaded by beamer.cls and certain options are set up." \hypersetup can be used to alter that but some options don't seem to have an effect eg. pdfborder={1 0 0}, pdftitle={abcd} don't work while pdfauthor={abcd} does work. I set up my presentation that it shows the citations with mouse-overs so biblatex is needed in this MWE. – maetra Nov 07 '12 at 11:27
  • I can't see any frame. However did you try \begin{minipage}[t] instead of \begin{minipage}[b] – Marco Daniel Apr 23 '13 at 18:51

1 Answers1

2

Using this low-level positioning of text after it's all been typeset will break hyperlinks, as within \bmb@bodybox they have already been processed. If you show the box you find the link as

\pdfstartlink(*+*)x* attr{/Border[1 1 1]/H/N/C[.5 .5 .5]} action goto name{cite.0@kastenholz}

(using pdfTeX). If you read the pdfTeX manual, you'll find that these are positioned absolutely. Thus the only way to move this material is to do it before you get as far as having it typeset in \bmb@bodybox. That is really a separate question, as we'll need to know what effect is desired.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036