[Tex/LaTex] beamerposter passing portrait options to custom theme

beamerbeamerposterkvoptionspackage-options

Hi I'm preparing a custom theme for beamerposter to align with the theme of my institution. I have to include a figure banner on the headline plus the possibility to include 2 different logos. So far I've done like this in the .sty file

\setbeamertemplate{headline}{  
\leavevmode
 \parbox{\textwidth}{\includegraphics[width=\paperwidth]{poster-banner}}
 \vskip-35ex
 \begin{beamercolorbox}[wd=\paperwidth]{headline}
 \begin{columns}[T]
  \begin{column}{.2\paperwidth}
    \begin{center} 
      \ifdefined\LeftLogo 
      \includegraphics[width=.6\linewidth,keepaspectratio,clip]{\LeftLogo} 
      \else 
      \fi 
    \end{center} 
    \vskip1.5cm 
  \end{column}
  \begin{column}{.65\paperwidth}
    \hskip1ex
    \vskip4ex
    \raggedright
    \usebeamercolor{title in headline}{\color{fg}\textbf{\LARGE{\inserttitle}}\\[1ex]}
    \usebeamercolor{author in headline}{\color{fg}\Large{\insertauthor}\\[0.5ex]}
    \usebeamercolor{institute in headline}{\color{fg}\large{\insertinstitute}\\[1ex]}     
  \end{column}
  \begin{column}{.15\paperwidth}
    \begin{center} 
      \ifdefined\RightLogo 
      \includegraphics[width=.6\linewidth,keepaspectratio,clip]{\RightLogo} 
      \else 
      \fi 
    \end{center} 
    \vskip1.5cm 
\end{column}
\end{columns}
\end{beamercolorbox}}

Where \RightLogo and \LeftLogo have been defined before the

\def\RightLogo{logoa.pdf}
\def\LeftLogo{logob.pdf}
\documentclass[final]{beamer}

The trick work nicely in portrait mode for beamerposter. But whenever I use landscape option the banner is too big in height. So I think I should pass the dimension of the banner and also the amoung of vskip differently according to the option passed to beamerposter (i.e. orientation=portrait, orientation = landscape). But I can't figure out how to infer this options.
I hope I explain my self. I know that I should give a MWE but I hope it is sufficient as I've done

Best Answer

The command \ifportrait detects the value of orientation. So you can replace your line

\parbox{\textwidth}{\includegraphics[width=\paperwidth]{poster-banner}}

with a test and appropriate code for each case

\ifportrait 
  \parbox{\textwidth}{\includegraphics[width=\textwidth]{poster-banner}}
\else
  \parbox{\textwidth}{\includegraphics[width=\textwidth,height=10cm]{poster-banner}}
\fi

The format is \ifportrait <portait-case> \else <landscape-case> \fi. I have made a random choice of a height of 10cm in the landscape case, you will need to write something appropriate four your particular case. For example, you might find a minipage more suitable than a \parbox and could write

\begin{minipage}{\textwidth}
   \centering\includegraphics[width=0.5\textwidth]{poster-banner}
\end{minipage}

in the landscape case.

To use this as a style, put the following in the file beamerthemeProva.sty

\mode<presentation>

\setbeamertemplate{headline}{  
\leavevmode
\ifportrait 
  \parbox{\textwidth}{\includegraphics[width=\textwidth]{example-image-a}}
\else
  \begin{minipage}{\textwidth}\centering\includegraphics[width=0.5\textwidth,height=15cm]{example-image-a}\end{minipage}
\fi
 \vskip-35ex
 \begin{beamercolorbox}[wd=\paperwidth]{headline}
 \begin{columns}[T]
  \begin{column}{.2\paperwidth}
    \begin{center} 
      \ifdefined\LeftLogo 
      \includegraphics[width=.6\linewidth,keepaspectratio,clip]{\LeftLogo} 
      \else 
      \fi 
    \end{center} 
    \vskip1.5cm 
  \end{column}
  \begin{column}{.65\paperwidth}
    \hskip1ex
    \vskip4ex
    \raggedright
    \usebeamercolor{title in headline}{\color{fg}\textbf{\LARGE{\inserttitle}}\\[1ex]}
    \usebeamercolor{author in headline}{\color{fg}\Large{\insertauthor}\\[0.5ex]}
    \usebeamercolor{institute in headline}{\color{fg}\large{\insertinstitute}\\[1ex]}     
  \end{column}
  \begin{column}{.15\paperwidth}
    \begin{center} 
      \ifdefined\RightLogo 
      \includegraphics[width=.6\linewidth,keepaspectratio,clip]{\RightLogo} 
      \else 
      \fi 
    \end{center} 
    \vskip1.5cm 
\end{column}
\end{columns}
\end{beamercolorbox}}

\mode<all>

and then you can have a main document (a variation on the standard example in the beamerposter distribution) such as the following

\def\RightLogo{example-image-a.pdf}
\def\LeftLogo{example-image-b.pdf}
\documentclass[final]{beamer}

\mode<presentation> { \usetheme{Berlin} 
\usepackage{times}
\usepackage{amsmath,amsthm, amssymb, latexsym}
\boldmath
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage[orientation=landscape,size=a0,scale=1.4,debug]{beamerposter}
\usetheme{Prova} }

  \graphicspath{{figures/}}
  \title[Fancy Posters]{Making Really Fancy Posters with \LaTeX}
  \author[Dreuw \& Deselaers]{Philippe Dreuw and Thomas Deselaers}
  \institute[RWTH Aachen University]{Human Language Technology and Pattern Recognition, RWTH Aachen University}
  \date{Jul. 31th, 2007}


  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
  \begin{document}
  \begin{frame}{} 
    \vfill
    \begin{block}{\large Fontsizes}
      \centering
      {\tiny tiny}\par
      {\scriptsize scriptsize}\par
      {\footnotesize footnotesize}\par
      {\normalsize normalsize}\par
      {\large large}\par
      {\Large Large}\par
      {\LARGE LARGE}\par
      {\veryHuge VeryHuge}\par
      {\VeryHuge VeryHuge}\par
      {\VERYHuge VERYHuge}\par
    \end{block}
    \vfill
    \vfill
    \begin{block}{\large Fontsizes}
      \centering
      {\tiny tiny}\par
      {\scriptsize scriptsize}\par
      {\footnotesize footnotesize}\par
      {\normalsize normalsize}\par
      {\large large}\par
      {\Large Large}\par
      {\LARGE LARGE}\par
      {\veryHuge VeryHuge}\par
      {\VeryHuge VeryHuge}\par
      {\VERYHuge VERYHuge}\par
    \end{block}
    \vfill
    \begin{columns}[t]
      \begin{column}{.48\linewidth}
        \begin{block}{Introduction}
          \begin{itemize}
          \item some items
          \item some items
          \item some items
          \item some items
          \end{itemize}
        \end{block}
      \end{column}
      \begin{column}{.48\linewidth}
        \begin{block}{Introduction}
          \begin{itemize}
          \item some items and $\alpha=\gamma, \sum_{i}$
          \item some items
          \item some items
          \item some items
          \end{itemize}
          $$\alpha=\gamma, \sum_{i}$$
        \end{block}

        \begin{block}{Introduction}
          \begin{itemize}
          \item some items
          \item some items
          \item some items
          \item some items
          \end{itemize}
        \end{block}

        \begin{block}{Introduction}
          \begin{itemize}
          \item some items and $\alpha=\gamma, \sum_{i}$
          \item some items
          \item some items
          \item some items
          \end{itemize}
          $$\alpha=\gamma, \sum_{i}$$
        \end{block}
      \end{column}
    \end{columns}
  \end{frame}
\end{document}

You can now change the orinetation from landscape to portrait and get different effects.