title: Insert the number of slides up to a final slide in a rmarkdown::beamer_presentation
body: <p>In a beamer presentation generated with <code>rmarkdown::beamer_presentation</code>, I currently have <code>\insertframenumber/\inserttotalframenumber</code> which shows the current page and the total number of slides in the presentation.</p>
  <p>How to insert the number of slides up to a &quot;final slide&quot; in the footer instead of the overall &quot;total number of slides&quot;?</p>
  <p><em>Note:</em> I would like to refrain from having to add <code>{.noframenumbering}</code> to all slides in the appendix.</p>
  <h2>MWE</h2>
  <h3>Preamble.tex</h3>
  <pre><code>\setbeamertemplate{footline}{
      \leavevmode%
      \hfill
          \hyperlinkappendixstart{\insertframenumber/\inserttotalframenumber}
  }
  </code></pre>
  <h3>Presentation.Rmd</h3>
  <pre><code>---
  title: &quot;Slide counter ends at specific slide&quot;
  output:
    bookdown::pdf_book:
      base_format: rmarkdown::beamer_presentation
      latex_engine: lualatex
      toc: false
      slide_level: 2
  header-includes:
    - \input{files_beamer/preamble}
  ---
  
  ## Slide 1
  
  ## Slide 2
  
  ## Slide Final
  ==&gt; count up to this slide
  
  ``` {=latex}
  \insertframeendpage
  ```
  
  ## Additional Slide 1 (not counted)
  
  ## Additional Slide 2 (not counted)
  </code></pre>