0

I'm creating a beamer document in that several PDF documents get included by a python script. To keep the style of the slides and including the PDFs I'm using the \includepdf like that:

\setbeamercolor{background canvas}{bg=}
\includepdf[pages={1-},width = 0.9\\textwidth,pagecommand={}]{*Path}

The *Path gets replaced with the PDF name by the python script. The problem is, that the page numbers are not getting updated with the added PDFs.

On the other hand I found at: Base document page numbers with pdfpages

A way to add the page numbers with:

\includepdf[pages=-,pagecommand=\thispagestyle{plain}]{filename}

But in that case my header and footer get lose.

Does someone as an idea how to combine both?

Greetings

Stefan

EDIT

A (hopefully) MWE that shows my problem:

\documentclass{beamer}
\mode<presentation>
{
\usetheme{Warsaw}
}
\usepackage[ngerman]{babel}
\usepackage{pdfpages}

%%---------FootLine------------------------
\setbeamertemplate{footline}
{%
\centering
\begin{tabular*}{\textwidth}{l@{\extracolsep\fill}c c c c}
    \hline
     & & & \\
    & \insertshorttitle & \today &   {\insertframenumber}
\end{tabular*} 
}

\setbeamertemplate{headline}
{
  \leavevmode%
  \hbox{%
  \hspace{2em}
  \begin{beamercolorbox}[wd=\paperwidth,ht=8.25ex,dp=3.5ex]{}%
    \raggedright  
    \vbox to 7.25ex{\vfil\hbox{\sffamily\Large\color{orange}\insertsection}\vfil}\\
    \vbox to0.25ex{\vfil\hbox{\sffamily\Large\color{orange}\insertsubsection}\vfil}    
  \end{beamercolorbox}%
  }%
}

\setbeamertemplate{frametitle}
{\vskip-3pt
  \leavevmode
  \hbox{%
  \begin{beamercolorbox}[wd=\paperwidth,ht=1.6ex,dp=1ex]{black_white}%
    \raggedright
    \hspace*{2em}
    {\normalsize\insertframetitle}
  \end{beamercolorbox}
  }%
}

\begin{document}
    \section*{First Section}
    \begin{frame}
        Hello1
    \end{frame}
    \newpage
    \begin{frame}
        Hello2
    \end{frame}
    \section*{PDF Test}
    \setbeamercolor{background canvas}{bg=}
    \includepdf[pages={-},width=0.9\textwidth,pagecommand={}]{test.pdf}
\end{document}
  • \incloudegraphics[page=1,height=\textheight] will put a single page into the text area. (This is actually what pdfpages uses.) – John Kormylo Sep 8 '15 at 13:03
  • But with \includegraphics I just can include one page of the PDF document, I want to include l want to include all pages (about 60 pages). – StefanN Sep 8 '15 at 13:09
  • One page per \includgraphics. If you had provided an MWE I could show you how to write a loop. BTW, a 60 page beamer presentation? – John Kormylo Sep 8 '15 at 13:16
  • What does MWE mean? Yes the presentation is a measurement report that should be in that format. The final presentation will be about 150 pages. – StefanN Sep 8 '15 at 13:25
  • MWE stands for "minimal working example" and means a short but compilable document around your command. meta.tex.stackexchange.com/questions/228/… – user36296 Sep 8 '15 at 13:51
2

I found the solution by following your loop tip. I included the forloop package, read out the maximum page number of the PDF document in python and create the for loop just when needed.

Just for your information, that is the test code of my solution:

\documentclass{beamer}
\mode<presentation>
{
\usetheme{Warsaw}
}
\usepackage[ngerman]{babel}
\usepackage{forloop}

%%---------FootLine------------------------
\setbeamertemplate{footline}
{%
\centering
\begin{tabular*}{\textwidth}{l@{\extracolsep\fill}c c c c}
    \hline
     & & & \\
    & \insertshorttitle & \today &   {\insertframenumber}
\end{tabular*} 
}

\setbeamertemplate{headline}{%
  \leavevmode%
  \hbox{%
  \hspace{2em}
  \begin{beamercolorbox}[wd=\paperwidth,ht=8.25ex,dp=3.5ex]{}%
    \raggedright  
    \vbox to 7.25ex{\vfil\hbox{\sffamily\Large\color{orange}\insertsection}\vfil}\\
    \vbox to0.25ex{\vfil\hbox{\sffamily\Large\color{orange}\insertsubsection}\vfil}    
  \end{beamercolorbox}%
  }%
}

\setbeamertemplate{frametitle}
{\vskip-3pt
  \leavevmode
  \hbox{%
  \begin{beamercolorbox}[wd=\paperwidth,ht=1.6ex,dp=1ex]{black_white}%
    \raggedright
    \hspace*{2em}
    {\normalsize\insertframetitle}
  \end{beamercolorbox}
  }%
}

\begin{document}
    \section*{First Section}
    \begin{frame}
        Hello1
    \end{frame}
    \newpage
    \begin{frame}
        Hello2
    \end{frame}
    \section*{PDF Test}
    \newcounter{ct}
    \forloop{ct}{1}{\value{ct} < 4}%
    {%
        \begin{frame}
            \includegraphics[page=\value{ct}, width=0.9\textwidth]{test.pdf}
        \end{frame}
    }
\end{document}

@JohnKormylo Thanks for your advice!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.