Internal section link fails in beamer output of pandoc markdown

I have tried the answer to this question, but I can't get the internal section links in Pandoc to work with the Latex Beamer output.

Following the Pandoc Documentation, I have created this minimal working example:

# Part One {#part-one}

## Section One {#section-one} 

### Frame one {#frame-one}

- Items... 

### Frame two {#frame-two}

- Items... 
- Link to [Section One](#section-one)

And built it using:

pandoc \
    --table-of-contents \
    -s -t beamer \
    -o test.pdf

The built LaTex Beamer pdf looks fine, but the internal link [Section One](#section-one) just isn't working. It should bring me to the "Section One" frame but it doesn't. How do I make this work?

Edit: here is the LaTex output for -o test.latex:

\setbeamertemplate{caption label separator}{:}
\setbeamercolor{caption name}{fg=normal text.fg}
\usepackage{fixltx2e} % provides \textsubscript
% use upquote if available, for straight quotes in verbatim environments
% use microtype if available

% Comment these out if you don't want a slide with just the
% part/section/subsection/subsubsection title:

\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em}  % prevent overfull lines




\part{Part One}\label{part-one}

\hyperdef{}{section-one}{\section{Section One}\label{section-one}}

\begin{frame}{Frame one}



\begin{frame}{Frame two}

  Link to \hyperref[section-one]{Section One}




I think I've pinpointed it to the ignorenonframetext in \documentclass[ignorenonframetext,]{beamer}, which is part of the default Pandoc beamer template.

Since the \hyperdef{}{part-one}{\section{Part One}\label{part-one}} is not inside a frame, it is apparently ignored by hyperref.

Could you try to create your own template (pandoc -D beamer > mytemplate.tex) without the ignorenonframetext and see whether that works without any adverse side effects? (When manually testing the .tex I always had to run LaTeX twice for the changes to take full effect.)

Posted on by mb21

Relevant tags