EDIT. Consider the following code. I wish to avoid empty beamercolorbox
, if the required item to insert therein is empty.
Consider the case of a section without a subsection, then the subsection beamercolorbox
should not be rendered (now is rendered anyway, as an empty strip)
\documentclass{beamer}
\usepackage[T1]{fontenc}
\mode<presentation>
\setbeamertemplate{navigation symbols}{}
\usetheme{Antibes}
\usecolortheme{seahorse}
\useoutertheme{tree}
\setbeamertemplate{footline}[frame number]
\usefonttheme{serif}
\makeatletter
\setbeamertemplate{headline}
{%
\begin{beamercolorbox}[wd=\paperwidth,colsep=1.5pt]{upper separation line head}
\end{beamercolorbox}
\begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{title in head/foot}
\usebeamerfont{title in head/foot}\insertshorttitle
\end{beamercolorbox}
\begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{section in head/foot}
\usebeamerfont{section in head/foot}%
\ifbeamer@tree@showhooks
\setbox\beamer@tempbox=\hbox{\insertsectionhead}%
\ifdim\wd\beamer@tempbox>1pt%
\hskip2pt\raise1.9pt\hbox{\vrule width0.4pt height1.875ex\vrule width 5pt height0.4pt}%
\hskip1pt%
\fi%
\else%
\hskip6pt%
\fi%
\ifdim\wd\beamer@tempbox>1pt% DA CAPIRE
{\thesection \;- \insertsectionhead}
\else
{}
\fi%
\end{beamercolorbox}
\begin{beamercolorbox}[wd=\paperwidth,ht=4.55ex,dp=1.125ex,%
% ht=4.75ex aumentato per sub titoli lunghi
leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
\usebeamerfont{subsection in head/foot}%
\ifbeamer@tree@showhooks
\setbox\beamer@tempbox=\hbox{\insertsubsectionhead}%
\ifdim\wd\beamer@tempbox>1pt%
\hskip9.4pt\raise1.9pt\hbox{\vrule width0.4pt height1.875ex\vrule width 5pt height0.4pt
}%
\hskip1pt%
\fi%
\else%
\hskip12pt%
\fi%
\ifdim\wd\beamer@tempbox>1pt% DA CAPIRE
{\thesection.\thesubsection \;- \insertsubsectionhead}
\else
{}
\fi%
\end{beamercolorbox}
\begin{beamercolorbox}[wd=\paperwidth,colsep=1.5pt]{lower separation line head}
\end{beamercolorbox}
}
\makeatother
\setbeamerfont{frametitle}{size=\fontsize{12}{14}}
\setbeamerfont{framesubtitle}{size=\fontsize{5}{4}}
\setbeamercolor{mycolor}{fg=blue,bg=yellow}
\setbeamercolor{frametitle}{fg=red}
\setbeamercolor{framesubtitle}{fg=black}
\title{test}
\author{m}
\date{\footnotesize{\today}}
\setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{subsection in toc}[subsections numbered]
\defbeamertemplate{subsubsection in toc}{subsubsections numbered}
{\leavevmode\leftskip=3em%
\rlap{\hskip-3em\inserttocsectionnumber.\inserttocsubsectionnumber.\inserttocsubsubsectionnumber}%
\inserttocsubsubsection\par}
\setbeamertemplate{subsubsection in toc}[subsubsections numbered]
\begin{document}\frame{\titlepage}
\begin{frame}{Hello}
Hello!
\end{frame}
\begin{frame}[t,noframenumbering]
\frametitle{Index}
\tableofcontents[pausesections, pausesubsections,sections={1-2}]
\end{frame}
\section{\textbf{{First}}}
\begin{frame}{A}
AAAA
\end{frame}
\section{Second}
\begin{frame}{B}
BBBB
\end{frame}
\subsection{Sub Second}
\begin{frame}{C}
CCCC
\end{frame}
\end{document}
Is there a way to code something like:
if shorttitle is empty do not insert the beamercolorbox, else insert it
.
I tried \ifstrempty
by the etoolbox
package, but I am not sure how to use it.
I need it for sectionhead
, subsectionhead
and so on too.
\insertshorttitle
will normally fall back to the full title. Do you want to print the box in this case?