# Beamer: how to show a logo in the vertical bar only if there is enough space left?

I would like to insert an additional (other than the top-left one) logo in a beamer presentation using Palo Alto theme, so that it appears in the navigation bar ONLY if there is enough space left.

What is the best way to achieve this result?

Until now, I've been able to place it to the desired position, but do not know how to let it "disapperar" instead of being uglily cut when there is not enough space for it.

Here is a minimal working example (it seems package mwe is not avaiable in my distribution, so i just created a red square image).

\documentclass{beamer}
\usetheme[hideothersubsections]{PaloAlto}
\usecolortheme{seahorse}
\setbeamercovered{transparent}

\makeatletter
\setbeamertemplate{sidebar \beamer@sidebarside}
{
\beamer@tempdim=\beamer@sidebarwidth%
{\usebeamerfont{title in sidebar}%
\vskip1.5em%
\hskip3pt%
\usebeamercolor[fg]{title in sidebar}%
\insertshorttitle[width=\beamer@tempdim,center,respectlinebreaks]\par%
\vskip1.25em%
}%
{%
\hskip3pt%
\usebeamercolor[fg]{author in sidebar}%
\usebeamerfont{author in sidebar}%
\insertshortauthor[width=\beamer@tempdim,center,respectlinebreaks]\par%
\vskip1.25em%
}%
\vfill
\ifx\beamer@sidebarside\beamer@lefttext%
\else%
\usebeamercolor{normal text}%
\vskip2pt%
\fi%
\hskip8pt
\includegraphics[height=1cm,keepaspectratio]{example-logo}~%
\vskip2pt
}
\makeatother
\logo{\includegraphics[height=0.7cm,keepaspectratio]{example-logo}}

\begin{document}

\section{Section1}

\frame{Test Frame 1}

\section{Section 2}
\subsection{Subsection1 is a very long-titled subsection}
\subsection{Subsection2 is a very long-titled subsection}
\subsection{Subsection3 is a very long-titled subsection}
\subsection{Subsection4 is a very long-titled subsection}
\subsection{Subsection5 is a very long-titled subsection}
\subsection{Subsection6 is a very long-titled subsection}
\subsection{Subsection7 is a very long-titled subsection}
\subsection{Subsection8 is a very long-titled subsection}
\subsection{Subsection9 is a very long-titled subsection}
\frame{test Frame 2}
\end{document}


As you can see below, while in the first frame the lower-left logo is nicely displayed, in the second one part of it is out of the frame. I want that, when this happens, the logo is simply not shown.

-
 I've modified the question and added an example document. Unfortunately it seems that mwe is not avaiable in my latex distribution (i use TexMaker on Ubuntu 12.04) – antosecret Sep 30 '12 at 12:42 Thank you for the MWE. Changing the image name to example-image-a makes it compilable. – percusse Sep 30 '12 at 12:46 @Tom: thank you for showing the image – antosecret Sep 30 '12 at 13:11 @antosecret: No problemo, that's what people with higher reputation are there for ;) – Tom Bombadil Sep 30 '12 at 13:12