TransWikia.com

In Beamer cannot link/ref/hyperref to a certain slide/frame where a label was placed

TeX - LaTeX Asked by AmIanonIm on July 22, 2021

This is the code I am using.

documentclass[xcolor=svgnames, aspectratio=169]{beamer}
usepackage[breakwords]{truncate}
usepackage{ragged2e}
usepackage{xcolor,colortbl}
hypersetup{
    pdfstartview={Fit},
    pdfpagemode=FullScreen,
    pdffitwindow=true,
    breaklinks=true,
    pdftitle={title},
    pdfauthor={author},
    pdfsubject={subject},
}

% usetheme[dark]{tpu}

usepackage[utf8]{inputenc}
usepackage[T2A]{fontenc}

usepackage{graphicx}
graphicspath{{images/}}
usepackage{wallpaper}
usepackage{booktabs}
usepackage{multicol}
usepackage[style=iso]{datetime2}
hypersetup{bookmarksopen=true,bookmarksopenlevel=4}
setcounter{tocdepth}{4}
hyphenpenalty=10000
usepackage{hyperref}

title{bla bla bla}
subtitle{othe bla}
normalsize
author{blaname blasurname}
date{today}

begin{document}

section{bla section 0}
begin{frame}[fragile] 
    frametitle{bla bla frame title 0}
    bla text 0
end{frame}

section{bla section 1}
subsection{bla subsection} label{blalabel1}
begin{frame}[fragile]
    frametitle{bla bla frame title}
    bla bla text
    Go to slide hyperref[blalabel2]{pageref{blalabel2}: nameref{blalabel2}} % <-------- This link
    Other way - Go to slide hyperref[blalabel2]{autoref{blalabel2}: nameref{blalabel2}} % <-------- This link
end{frame}

begin{frame}[fragile] 
    frametitle{bla bla frame title 2}
    bla text 2
end{frame}

subsection{bla subsection 2} label{blalabel2} % <------- This destination frame/section/label
begin{frame}[fragile] 
    frametitle{bla bla frame title 3}
    bla text 3
end{frame}

end{document}

The link is created but when clicked it sends me to the first page of the document, not to the desired page.
Links in ToC work perfectly, when clicked they send me to the correct frame/page/slide/label location. The "problem" is only with normal (outside ToC) linking. How do I link (or maybe label) correctly to achieve the desired functionality?

One Answer

You can put the label into the optional argument of the frame and then use hyperlink. See the documentation of beamer, 11.1 Adding Hyperlinks and Buttons. It also describes how to target a specific slide.

documentclass[xcolor={svgnames,table}, aspectratio=169]{beamer}
usepackage[breakwords]{truncate}
usepackage{ragged2e}

hypersetup{
    pdfstartview={Fit},
    pdfpagemode=FullScreen,
    pdffitwindow=true,
    pdftitle={title},
    pdfauthor={author},
    pdfsubject={subject},
    bookmarksopen=true,bookmarksopenlevel=4
}

usepackage[T2A]{fontenc}

usepackage{graphicx}
graphicspath{{images/}}
usepackage{wallpaper}
usepackage{booktabs}
usepackage{multicol}
usepackage[style=iso]{datetime2}
setcounter{tocdepth}{4}
hyphenpenalty=10000


title{bla bla bla}
subtitle{othe bla}
normalsize
author{blaname blasurname}
date{today}

begin{document}

section{bla section 0}
begin{frame}[fragile]
    frametitle{bla bla frame title 0}
    bla text 0
end{frame}

section{bla section 1}
subsection{bla subsection} 
begin{frame}[fragile,]
    frametitle{bla bla frame title}
    bla bla text
    Go to slide hyperlink{blalabel2}{pageref*{blalabel2}: nameref*{blalabel2}} % <-------- This link
    Other way - Go to slide hyperlink{blalabel2}{autoref*{blalabel2}: nameref*{blalabel2}} % <-------- This link
end{frame}

begin{frame}[fragile]
    frametitle{bla bla frame title 2}
    bla text 2
end{frame}

subsection{bla subsection 2}  
begin{frame}[fragile,label=blalabel2]
    frametitle{bla bla frame title 3}
    bla text 3
end{frame}

Correct answer by Ulrike Fischer on July 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP