Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When I use \ref*{xx} in beamer, it gives me an error: "pdfTeX warning (dest): name{*} has been referenced but does not exist." Does beamer fool with it, or what am I missing?

If I run a regular MWE it works great.

\documentclass{article}
\usepackage{hyperref}
\usepackage{lipsum}

\begin{document}
\section{First}
\lipsum[1-3]

\section{Second}
\lipsum[4-5]
Label \label{jh}

\section{Third}
\lipsum[6-9]

Reference: \ref*{jh}
\end{document}

It prints a "2" there, without a hyper-reference.

But in beamer, my mwe gives me the error I mentioned at the start.

\documentclass{beamer}

\begin{document}
\section{test section}
\begin{frame}
  Label: \label{jh}
\end{frame}

\begin{frame}
  Reference: \ref*{jh}
\end{frame}
\end{document}

A regular \ref (no star) works fine. It prints the reference, and makes it hyper also.

I have downloaded beamer from CTAN today, and I downloaded oberdiek also, because I was getting warnings about the date of some loaded packages, which I have resolved. Beyond that, I have the TeXLive 2009 that comes with Ubuntu 10.04's package manager.

(FWIW, I want \ref* because the references come from another document courtesy of xr.sty.)

share|improve this question
    
Right, beamer.clsdoes not provide a \ref* command. You have to define it yourself. –  Daniel Apr 2 '12 at 16:03
1  
@Daniel, that was my first thought as well, but beamer loads hyperref and hyperref defines \ref* so arguably it should work, but then beamer redefines \ref again.... –  David Carlisle Apr 2 '12 at 16:32
5  
Your user info shows "0% accept rate", which means that you haven't accepted any answer for any of your 5 questions. I believe that you have got some useful answers for some of the questions that you should accept and bring the answerer the reputation. You can read more on this in the FAQ. –  tohecz Apr 2 '12 at 16:48
add comment

2 Answers

Elaborating on David's answer, beamer does modify \ref, just like most other macros and environments. Within beameroverlay.sty, the following is executed:

\AtBeginDocument
{
  \let\beamer@origref=\ref
  \long\def\ref#1{\hyperlink{#1}{\beamer@origref{#1}}}
}

removing the starred capability of \ref (since \hyperlink{*}{...} has no meaning). Here's a minimal example that refines \reff which returns the original starred-variant. I'm sure you can also redefine \ref in this way.

\documentclass{beamer}% http://ctan.org/pkg/beamer
\usepackage{xparse}% http://ctan.org/pkg/xparse

\makeatletter
\NewDocumentCommand{\reff}{s m}{%
  \IfBooleanTF{#1}% Check for starred variant
    {\beamer@origref{#2}}% \reff*
    {\hyperlink{#2}{\beamer@origref{#2}}}% \reff
}
\makeatother

\begin{document}
\section{test section}
\begin{frame}
  Label: \label{jh}
\end{frame}

\begin{frame}
  Reference: \ref{jh}, \reff{jh}, \reff*{jh}
\end{frame}
\end{document}​
share|improve this answer
    
Thank you, David and Werner. I particularly appreciate the confirmation that it is not something I am doing wrong, or something with my setup. I have reported the problem as a bug on the bitbucket.org beamer archive. –  Jim Hefferon Apr 2 '12 at 16:50
2  
I will have to do this by hand in beamer, as I can't require xparse there :-) –  Joseph Wright Apr 2 '12 at 17:08
add comment

beamer and hyperref (as loaded by beamer) appear to get into a tangle each saving an "original" version of \ref and each layering on extra functionality.

This tips things back in the direction of hyperref's definition, I'm not sure how much beamer functionality it loses, but it seems to work on this example,

\documentclass{beamer}

{\def\protect{\global\let\YesIMeanThisRef}\ref}

\AtBeginDocument{\def\ref{\protect\YesIMeanThisRef}}

\begin{document}

\section{test section}
\begin{frame}
  Label: \label{jh}
\end{frame}

\begin{frame}
  Reference: \ref*{jh}
\end{frame}
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.