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.

I am including some pages using pdfpages in beamer. I understand that these pages can not be included a frames. Rather these are included as simple texts. So far so good.

However, I get incorrect frame counts in slide footers. Please see this minimal example,

\documentclass{beamer}

\usepackage{pdfpages}

\mode<presentation>
{
  \usetheme{Luebeck}
  \setbeamercovered{transparent}
}

\usepackage{times}

% Frame numbers
\expandafter\def\expandafter\insertshorttitle\expandafter{%
  \insertshorttitle\hfill\insertframenumber\,/\,\inserttotalframenumber}

\begin{document}

\begin{frame}
  \frametitle{First Frame}
\end{frame}

\begingroup
  \setbeamercolor{background canvas}{bg=}
  \includepdf[pages=1-10]{mypdf.pdf}
\endgroup

\begin{frame}
  \frametitle{Last Frame}
\end{frame}


\end{document}

While I need the first slide to have the number 1/12, and the last slide 12/12, this actually comes out to be 1/2 and 2/2. I know that beamer is doing nothing wrong. This is mathematically 100% correct. But from a user point of view, this is not intended.

Is there any way I can incorporate non-frame pages in slide counts?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

After a number of trial and errors and code hacking, I have found the solution like this.

\def\getpdfpages#1#2{\begingroup
  \setbeamercolor{background canvas}{bg=}
  \includepdf[pages={#1},%
  pagecommand={\global\setcounter{framenumber}{\value{page}}%
    \expandafter\def\expandafter\insertshorttitle\expandafter{%
      \insertshorttitle\hfill\insertframenumber\,/\,\inserttotalframenumber}}%
  ]{#2}
  \endgroup}

For the above macro, the first argument is the range of pages, the second one is the .pdf file name. So, you call it like this,

\getpdfpages{{4-5}}{mypdf.pdf}

or

\getpdfpages{{4,7}}{mypdf.pdf}

or

\getpdfpages{{4-5,7,10-12}}{mypdf.pdf}
share|improve this answer

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.