0

I have a following beautiful minimal presentation, which allows to show a automatically sized image on the slides (frame,page).

I would like to have two pictures next to each other with about 45% of size width (about 0.5-1cm on right/left white), such as:

|-----------------------------------------|
|  1. Section                             |
|                                         |
|  . bla bla                              |
|      . bla bla                          |
|                                         |
|  xxxxxxxxxxxxxxxx    xxxxxxxxxxxxxxxxx  |
|  xxxxxxxxxxxxxxxx    xxxxxxxxxxxxxxxxx  |
|  xxxxxxxxxxxxxxxx    xxxxxxxxxxxxxxxxx  |
|  xxxxxxxxxxxxxxxx    xxxxxxxxxxxxxxxxx  |
|  xxxxxxxxxxxxxxxx    xxxxxxxxxxxxxxxxx  |
|  xxxxxxxxxxxxxxxx    xxxxxxxxxxxxxxxxx  |
|  xxxxxxxxxxxxxxxx    xxxxxxxxxxxxxxxxx  |
|  xxxxxxxxxxxxxxxx    xxxxxxxxxxxxxxxxx  |
|                                         |
|-----------------------------------------|

The pictures would have to be automatically sized (calc), like I did into my minimal example.

Besides, believe me, calc is extremely useful to size the images automatically !!!

\documentclass[12pt,t]{beamer}

\usepackage{url}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{color}

\usetheme{CambridgeUS}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{headline}{}{}
\addtobeamertemplate{headline}{}{\textcolor{white}{\rule{\paperwidth}{5pt}}
}

\setbeamertemplate{footline}[frame number]{}
\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{beamer.jpg}}


\newcommand{\unititle}[1]{\title{#1}}
\newcommand{\uniauthor}[1]{\author{#1}}
\newcommand{\uniinstitute}[2]{\institute[#1]{#2}}
\newcommand{\unisection}[1]{\frametitle{#1}}
\newcommand{\unimaketitle}[1]{
\begin{frame}
\maketitle
\end{frame}
}

\usepackage{calc}
\newcommand{\unifig}[2]{
\begin{center}
\hspace{-1cm}\includegraphics[width=#2\textwidth*\real{0.91},keepaspectratio]{#1}
\end{center}
}

\usepackage{xparse,calc}
\newlength\fitimageht
\newlength\fitotherht
\newsavebox\fitimagebox
\NewDocumentCommand \fitimage { m m O {} }{%
  \sbox\fitimagebox{%
     \parbox{\textwidth}{%
       #1\par
       #3
    }%
  }%
  \settototalheight{\fitotherht}{%
     \usebox\fitimagebox
  }%
  \setlength\fitimageht{\textheight}%
  \addtolength\fitimageht{-\fitotherht-\topskip-\footskip-3\baselineskip}%
  #1\par
   \centering
   \includegraphics[width=\textwidth,height=\fitimageht,keepaspectratio]{#2}\par
  #3}



\begin{document}


\section{Section}
\begin{frame}
\fitimage{
\frametitle{\thesection.~\insertsection}
\begin{itemize}
\item Header
\begin{itemize}
\item this is an example
\end{itemize}
\end{itemize}
}{tux.png}[]
\end{frame}


\end{document}

I have looked the way you did, but there is too much space in the middle of the slide to separate the images. Maybe I did something wrong in the final code, working for a slide with 1 picture and a slide with 2 pictures... Your review of the below code could be of great benefit. Thank you a lot!!!!

\documentclass[12pt,t]{beamer}

\usepackage{url}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{color}

\usetheme{CambridgeUS}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{headline}{}{}
\addtobeamertemplate{headline}{}{\textcolor{white}{\rule{\paperwidth}{5pt}}
}

\setbeamertemplate{footline}[frame number]{}
\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{beamer.jpg}}


\newcommand{\unititle}[1]{\title{#1}}
\newcommand{\uniauthor}[1]{\author{#1}}
\newcommand{\uniinstitute}[2]{\institute[#1]{#2}}
\newcommand{\unisection}[1]{\frametitle{#1}}
\newcommand{\unimaketitle}[1]{
\begin{frame}
\maketitle
\end{frame}
}

\usepackage{calc}
\newcommand{\unifig}[2]{
\begin{center}
\hspace{-1cm}\includegraphics[width=#2\textwidth*\real{0.91},keepaspectratio]{#1}
\end{center}
}



\usepackage{xparse,calc}
\newlength\fitimageht
\newlength\fitotherht
\newsavebox\fitimagebox
\NewDocumentCommand \fitimageab { m m m O {} }{%
  \sbox\fitimagebox{%
     \parbox{\textwidth}{%
       #1\par
       #4
    }%
  }%
  \settototalheight{\fitotherht}{%
     \usebox\fitimagebox
  }%
  \setlength\fitimageht{\textheight}%
  \addtolength\fitimageht{-\fitotherht-\topskip-\footskip-3\baselineskip}%
  #1\par
   \begin{columns}[onlytextwidth]
   \column{.45\linewidth}
   \centering
   \includegraphics[width=\textwidth,height=\fitimageht,keepaspectratio]{#2}
   \column{.45\linewidth}
   \centering
   \includegraphics[width=\textwidth,height=\fitimageht,keepaspectratio]{#3}
   \end{columns}\par
#4}


\usepackage{xparse,calc}
%\newlength\fitimageht
%\newlength\fitotherht
%\newsavebox\fitimagebox
\NewDocumentCommand \fitimage { m m O {} }{%
  \sbox\fitimagebox{%
     \parbox{\textwidth}{%
       #1\par
       #3
    }%
  }%
  \settototalheight{\fitotherht}{%
     \usebox\fitimagebox
  }%
  \setlength\fitimageht{\textheight}%
  \addtolength\fitimageht{-\fitotherht-\topskip-\footskip-3\baselineskip}%
  #1\par
   \centering
   \includegraphics[width=\textwidth,height=\fitimageht,keepaspectratio]{#2}\par
#3}

\begin{document}

\section{Section 1}
\begin{frame}
\fitimage{
\frametitle{\thesection.~\insertsection}
\begin{itemize}
\item Header
\begin{itemize}
\item this is an example
\end{itemize}
\end{itemize}
}{tux.jpg}[]
\end{frame}



\section{Section 2}
\begin{frame}
\fitimageab{
\frametitle{\thesection.~\insertsection}
\begin{itemize}
\item Header
\begin{itemize}
\item this is an example
\end{itemize}
\end{itemize}
}{tux.jpg}{tux.jpg}
\end{frame}


\end{document}

enter image description here

enter image description here

1
  • 1
    beamer already loads hyperref, graphicx and xcolor (which is a color replacement), so you don't need to load them again.
    – Ignasi
    Oct 26, 2017 at 15:10

1 Answer 1

1

Following code uses columns beamer environment. I don't know if it adjusts to intended results, but it's an easy solution:

enter image description here

\documentclass[12pt,t]{beamer}

\usepackage{url}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{color}

\usetheme{CambridgeUS}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{headline}{}{}
\addtobeamertemplate{headline}{}{\textcolor{white}{\rule{\paperwidth}{5pt}}
}

\setbeamertemplate{footline}[frame number]{}
\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{example-image.jpg}}


\newcommand{\unititle}[1]{\title{#1}}
\newcommand{\uniauthor}[1]{\author{#1}}
\newcommand{\uniinstitute}[2]{\institute[#1]{#2}}
\newcommand{\unisection}[1]{\frametitle{#1}}
\newcommand{\unimaketitle}[1]{
\begin{frame}
\maketitle
\end{frame}
}

\usepackage{calc}
\newcommand{\unifig}[2]{
\begin{center}
\hspace{-1cm}\includegraphics[width=#2\textwidth*\real{0.91},keepaspectratio]{#1}
\end{center}
}

\usepackage{xparse,calc}
\newlength\fitimageht
\newlength\fitotherht
\newsavebox\fitimagebox
\NewDocumentCommand \fitimage { m m m O {} }{%
  \sbox\fitimagebox{%
     \parbox{\textwidth}{%
       #1\par
       #4
    }%
  }%
  \settototalheight{\fitotherht}{%
     \usebox\fitimagebox
  }%
  \setlength\fitimageht{\textheight}%
  \addtolength\fitimageht{-\fitotherht-\topskip-\footskip-3\baselineskip}%
  #1\par
   \begin{columns}[onlytextwidth]
   \column{.45\linewidth}
   \centering
   \includegraphics[width=\textwidth,height=\fitimageht,keepaspectratio]{#2}
   \column{.45\linewidth}
   \centering
   \includegraphics[width=\textwidth,height=\fitimageht,keepaspectratio]{#3}
   \end{columns}\par
  #4}



\begin{document}


\section{Section}
\begin{frame}
\fitimage{
\frametitle{\thesection.~\insertsection}
\begin{itemize}
\item Header
\begin{itemize}
\item this is an example
\end{itemize}
\end{itemize}
}{example-image-a}{example-image-b}[\begin{itemize}\item Some text after images \item And some more\end{itemize}]
\end{frame}


\end{document}

You must log in to answer this question.

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