1

I am making some handouts with Beamer, but I don't manage to get page numbers in the document. I print 4 frames on each page, and I do get the frame numbers, but I need the page numbers as well. It seems I can't add these directly in the resulting pdf, at least not with my Adobe Acrobat Reader DC, so it seems it must be done beforehand, before converting the document into pdf. Here is an example of what I put in the preamble.

\documentclass[handout]{beamer}
\usepackage{pgfpages}
\pgfpagesuselayout{4 on 1}[a4paper,border shrink=5mm, landscape]
\setbeamertemplate{headline}{\scriptsize{\vspace*{0.3cm}\hspace*{0.3cm}

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

\usefonttheme[onlymath]{serif}

\usetheme{Szeged}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{tipa}
    \usepackage{eurosym}
\usepackage{wasysym}
\usepackage{colortbl}
\usepackage{wrapfig}
\usepackage{graphics}
\usepackage{linguex}
\usepackage{cgloss4e}
\usepackage{csquotes}
\usepackage{xspace}
\usepackage{color}
\usepackage{xyling}
\usepackage{setspace}
\usepackage{amsfonts}
\usepackage{phonetic}
\usepackage{multicol}
\usepackage{booktabs}

\usepackage[backend=biber, style=authoryear-comp]{biblatex}
\addbibresource{ref.bib}

% \strikeout{text}: prints a struck-out version of #1
\newlength{\howlong}
\newcommand{\strikeout}[1]{
 \settowidth{\howlong}{#1}%
 #1\unitlength0.5ex%
 \begin{picture}(0,0)
 \put(0,1){\line(-1,0){\howlong\divide\unitlength}}
 \end{picture}%
}

\setbeamertemplate{headline}{%
\leavevmode%
  \hbox{%
    \begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex]{palette quaternary}%
    \insertsectionnavigationhorizontal{\paperwidth}{}{\hskip0pt plus1filll}
    \end{beamercolorbox}%
  }
}

\setbeamertemplate{footline}
{%
    \begin{beamercolorbox}[colsep=1.5pt]{upper separation line foot}
    \end{beamercolorbox}
    \begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
        leftskip=.3cm,rightskip=.3cm plus1fil]{author in head/foot}%
        \leavevmode{\usebeamerfont{author in head/foot}\insertshortauthor}%
        \hfill%
        \leavevmode{\usebeamerfont{title in head/foot}\insertshorttitle}%
        \hfill%
        {\usebeamerfont{institute in head/foot}\usebeamercolor[fg]{institute in head/foot}\insertshortinstitute}%
    \end{beamercolorbox}%
    \begin{beamercolorbox}[colsep=1.5pt]{lower separation line foot}
    \end{beamercolorbox}
}

\setbeamercovered{transparent=30}
\beamertemplateballitem


\title{XXX}
\subtitle{YYY}
\author{ME}
\institute{Mordor}
\date{\today}

\newcommand{\textunderscript}[1]{$_{\text{#1}}$}

\begin{document}

\frame {
\frametitle{Flaflafla}

xxxxxxxx}

\end{document}
1
  • Offtopic, but with beamer you do not need packages like graphics or color, they are already provided by beamer. Jun 21, 2016 at 15:00

2 Answers 2

1

The following will add a pagenumber at the bottom

\documentclass[handout]{beamer}
\usepackage{pgfpages}
\pgfpagesuselayout{4 on 1}[a4paper,border shrink=5mm, landscape]
\setbeamertemplate{headline}{\scriptsize{\vspace*{0.3cm}\hspace*{0.3cm}\insertframenumber}}
\expandafter\def\expandafter\insertshorttitle\expandafter{%
  \insertshorttitle\hfill%
  \insertframenumber\,/\,\inserttotalframenumber}

\makeatletter
\def\pgfsys@endpicture{%
    \makebox[\pgfphysicalwidth]{\the\numexpr\value{page}/4\relax}%
}
\makeatother


\begin{document}
\frame{}
\end{document}

enter image description here


Edit:

with the MWE from the question

\documentclass[handout]{beamer}
\usepackage{pgfpages}
\pgfpagesuselayout{4 on 1}[a4paper,border shrink=5mm, landscape]
\setbeamertemplate{headline}{\scriptsize{\vspace*{0.3cm}\hspace*{0.3cm}

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

\usefonttheme[onlymath]{serif}

\usetheme{Szeged}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{tipa}
    \usepackage{eurosym}
\usepackage{wasysym}
\usepackage{colortbl}
\usepackage{wrapfig}
\usepackage{graphics}
\usepackage{linguex}
\usepackage{cgloss4e}
\usepackage{csquotes}
\usepackage{xspace}
\usepackage{color}
\usepackage{xyling}
\usepackage{setspace}
\usepackage{amsfonts}
\usepackage{phonetic}
\usepackage{multicol}
\usepackage{booktabs}

\usepackage[backend=biber, style=authoryear-comp]{biblatex}
\addbibresource{ref.bib}

% \strikeout{text}: prints a struck-out version of #1
\newlength{\howlong}
\newcommand{\strikeout}[1]{
 \settowidth{\howlong}{#1}%
 #1\unitlength0.5ex%
 \begin{picture}(0,0)
 \put(0,1){\line(-1,0){\howlong\divide\unitlength}}
 \end{picture}%
}

\setbeamertemplate{headline}{%
\leavevmode%
  \hbox{%
    \begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex]{palette quaternary}%
    \insertsectionnavigationhorizontal{\paperwidth}{}{\hskip0pt plus1filll}
    \end{beamercolorbox}%
  }
}

\setbeamertemplate{footline}
{%
    \begin{beamercolorbox}[colsep=1.5pt]{upper separation line foot}
    \end{beamercolorbox}
    \begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
        leftskip=.3cm,rightskip=.3cm plus1fil]{author in head/foot}%
        \leavevmode{\usebeamerfont{author in head/foot}\insertshortauthor}%
        \hfill%
        \leavevmode{\usebeamerfont{title in head/foot}\insertshorttitle}%
        \hfill%
        {\usebeamerfont{institute in head/foot}\usebeamercolor[fg]{institute in head/foot}\insertshortinstitute}%
    \end{beamercolorbox}%
    \begin{beamercolorbox}[colsep=1.5pt]{lower separation line foot}
    \end{beamercolorbox}
}

\setbeamercovered{transparent=30}
\beamertemplateballitem


\makeatletter
\def\pgfsys@endpicture{%
    \makebox[\pgfphysicalwidth]{\the\numexpr\value{page}/4\relax}%
}
\makeatother

\title{XXX}
\subtitle{YYY}
\author{ME}
\institute{Mordor}
\date{\today}

\newcommand{\textunderscript}[1]{$_{\text{#1}}$}

\begin{document}

\frame {
\frametitle{Flaflafla}

xxxxxxxx}

\end{document}

enter image description here

12
  • Hi, unfortunately that does not seem to work. Still no page numbers...
    – EspenJK
    Jun 20, 2016 at 19:09
  • @EspenJK Strange! I get a number at the bottom of the page, see the screenshot. Jun 20, 2016 at 19:32
  • Yes, it is indeed strange. For me, it does not give page numbers, and it also seems to mess up all frames carrying bullet points or similar... It could be related to something else in the preamble, then. I will provide the complete preamble.
    – EspenJK
    Jun 21, 2016 at 7:00
  • 1
    @EspenJK Therefore, I think that creating a minimal working example (MWE) would be useful. Indeed, by reducing your code, you might identify what part causes the page number not to be printed.
    – ebosi
    Jun 21, 2016 at 7:08
  • Right, I've tried that... Removing parts of the preamble results in different types of small errors, but I still haven't found anything that adds the page numbers. Not even the minimal example suggested above by Sam Carter.
    – EspenJK
    Jun 21, 2016 at 7:58
1

An alternative to pgfpages could be pdfpages. In this case, you create the beamer presentation, an later on include it as an external file inside the handout document which could be something like:

\documentclass[a4paper, landscape]{article}
\usepackage[vmargin={2cm,1.5cm}]{geometry}
\usepackage{pdfpages}

\begin{document}
\includepdf[pages=1-8,nup=2x2,frame, scale=.9, delta= 10 10, pagecommand={}]{Numeracio}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .