7

I would like to have a single slide which has only one image on it. No navigation, no border. Nothing, only the image. If that means that the PDF page has a different size than other pages, that is fine for me.

Currently, my best try looks like this:

enter image description here

Minimal example

I tried to make a \framedgraphiconly command:

\documentclass[hyperref={pdfpagelabels=false},usepdftitle=false]{beamer}
\usetheme{Frankfurt} % see http://deic.uab.es/~iblanes/beamer_gallery/index_by_theme.html as fallback
\usecolortheme{beaver}
\usefonttheme{professionalfonts}
\usepackage{hyperref}
\usepackage[utf8]{inputenc} % this is needed for german umlauts
\usepackage[english]{babel} % this is needed for german umlauts
\usepackage[T1]{fontenc}    % this is needed for correct output of umlauts in pdf
\usepackage{tikz}

\newcommand {\framedgraphiconly}[1] {
    \setbeamertemplate{navigation symbols}{}
    \begin{frame}[plain]
        \begin{center}
            \includegraphics[width=\paperwidth,height=\paperheight,keepaspectratio]{#1}
        \end{center}
        %\begin{tikzpicture}[remember picture,overlay]
            %\node[at=(current page.center)] {
                %\includegraphics[width=\paperwidth,height=\paperheight,keepaspectratio]{#1}
            %};
        %\end{tikzpicture}
    \end{frame}
}

\beamertemplatenavigationsymbolsempty

% Begin:Move navigation from top to bottom
\setbeamertemplate{navigation symbols}{}
\makeatletter
\setbeamertemplate{footline}
{%
  \pgfuseshading{beamer@barshade}%
  \ifbeamer@sb@subsection%
    \vskip-9.75ex%
  \else%
    \vskip-7ex%
  \fi%
  \begin{beamercolorbox}[ignorebg,ht=2.25ex,dp=3.75ex]{section in head/foot}
    \insertnavigation{\paperwidth}
  \end{beamercolorbox}%
  \ifbeamer@sb@subsection%
    \begin{beamercolorbox}[ignorebg,ht=2.125ex,dp=1.125ex,%
      leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
      \usebeamerfont{subsection in head/foot}\insertsubsectionhead
    \end{beamercolorbox}%
  \fi%
}%
\setbeamertemplate{headline}{%
}
\makeatother
% End:Move navigation from top to bottom


\begin{document}

\title{Art in Machine Learning}
\subtitle{\href{https://github.com/MartinThoma/}{github.com/MartinThoma/}}
\author{Martin Thoma}
\date{15. Januar 2016}
\subject{Machine Learning}

\frame{\titlepage}

\section{Examples}
\subsection{Examples}
\framedgraphiconly{0099.jpg}

\section{ML-Basics}
\subsection{ML-Basics}

\begin{frame}{Was ist Machine Learning?}
    \begin{block}{Definition by Tom Mitchell: ML}
        A computer program is said to learn from \textbf{experience} $E$ with
        respect to some class of \textbf{tasks} $T$ and \textbf{performance
        measure} $P$, if its performance at tasks in $T$, as measured by $P$,
        improves with experience $E$.
    \end{block}
\end{frame}

\end{document}

If you want the image, it is on https://github.com/MartinThoma/LaTeX-examples/tree/master/presentations/ImageOnly

Question

How can I get a PDF page of the size of an image exactly? In my example: How can I get rid of the white borders without changing the image / the aspect ratio how the image appears? (And whe is there white space on two sides left?)

  • 1
    center environment adds vertical space so you should get rid of that first – David Carlisle Jan 10 '16 at 22:03
  • 1
    width=\paperwidth,height=\paperheight,keepaspectratio will leave a border on vertical or horizontal edges unless the image has the same aspect ratio as the page. – David Carlisle Jan 10 '16 at 22:04
  • 1
    @DavidCarlisle Yes, this problem with the aspect ratio is my main question. PDF pages seem to be able to have many (arbitrary?) size. Can I somehow make this single frame have the same aspect ratio as the image has? – Martin Thoma Jan 10 '16 at 22:08
  • 1
    So you really want just a single PDF page with different size than the other pages? ... – yo' Jan 10 '16 at 22:10
  • 1
    When you project it, it may be distorted if the aspect ratio is not correct i.e. if the ratio for the projection doesn't match the ratio for the page. I'm not sure about this. Maybe you will just get a border. But I think it will probably stretch it to fit the rectangle. – cfr Jan 10 '16 at 22:14
10

incgraph

enter image description here

does what you want:

enter image description here

\documentclass[hyperref={pdfpagelabels=false},usepdftitle=false]{beamer}
\usetheme{Frankfurt} % see http://deic.uab.es/~iblanes/beamer_gallery/index_by_theme.html as fallback
\usecolortheme{beaver}
\usefonttheme{professionalfonts}
\usepackage{hyperref}
\usepackage[utf8]{inputenc} % this is needed for german umlauts
\usepackage[english]{babel} % this is needed for german umlauts
\usepackage[T1]{fontenc}    % this is needed for correct output of umlauts in pdf
\usepackage{tikz}
\usepackage{incgraph}

\newcommand {\framedgraphiconly}[1] {
    \setbeamertemplate{navigation symbols}{}
    \begin{frame}[plain]
        \begin{center}
            \includegraphics[width=\paperwidth,height=\paperheight,keepaspectratio]{#1}
        \end{center}
        %\begin{tikzpicture}[remember picture,overlay]
            %\node[at=(current page.center)] {
                %\includegraphics[width=\paperwidth,height=\paperheight,keepaspectratio]{#1}
            %};
        %\end{tikzpicture}
    \end{frame}
}

\beamertemplatenavigationsymbolsempty

% Begin:Move navigation from top to bottom
\setbeamertemplate{navigation symbols}{}
\makeatletter
\setbeamertemplate{footline}
{%
  \pgfuseshading{beamer@barshade}%
  \ifbeamer@sb@subsection%
    \vskip-9.75ex%
  \else%
    \vskip-7ex%
  \fi%
  \begin{beamercolorbox}[ignorebg,ht=2.25ex,dp=3.75ex]{section in head/foot}
    \insertnavigation{\paperwidth}
  \end{beamercolorbox}%
  \ifbeamer@sb@subsection%
    \begin{beamercolorbox}[ignorebg,ht=2.125ex,dp=1.125ex,%
      leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
      \usebeamerfont{subsection in head/foot}\insertsubsectionhead
    \end{beamercolorbox}%
  \fi%
}%
\setbeamertemplate{headline}{%
}
\makeatother
% End:Move navigation from top to bottom


\begin{document}

\title{Art in Machine Learning}
\subtitle{\href{https://github.com/MartinThoma/}{github.com/MartinThoma/}}
\author{Martin Thoma}
\date{15. Januar 2016}
\subject{Machine Learning}

\frame{\titlepage}

\section{Examples}
\subsection{Examples}
%\framedgraphiconly{0099.jpg}

\incgraph{0099.jpg}

\section{ML-Basics}
\subsection{ML-Basics}

\begin{frame}{Was ist Machine Learning?}
    \begin{block}{Definition by Tom Mitchell: ML}
        A computer program is said to learn from \textbf{experience} $E$ with
        respect to some class of \textbf{tasks} $T$ and \textbf{performance
        measure} $P$, if its performance at tasks in $T$, as measured by $P$,
        improves with experience $E$.
    \end{block}
\end{frame}

\end{document}
  • It looks fine for my minimal example. However, when I include it in my real document, I get ! LaTeX Error: Option clash for package hyperref. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.86 \RequirePackage{hyperref}[2010/06/18]. - Do you have an idea how to fix it? – Martin Thoma Jan 11 '16 at 9:17
  • @moose Hyperref is loaded twice with different options; this is a common problem. Try adding \RequirePackage{incgraph} before \begin{document}. – yo' Jan 11 '16 at 9:28
  • 3
    @moose: incgraph loads hyperref thorugh bookmarks package. It has option nobookmark (and some others) to avoid loading it and problems with your previous loading options. Try \usepackage[nobookmar]{incgraph} – Ignasi Jan 11 '16 at 9:32
  • Thank you, that worked fine (\usepackage[nobookmark]{incgraph}). – Martin Thoma Jan 11 '16 at 9:40

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.