I was trying to have some standard (sub(sub))sections, where beamer would automatically create a slide dedicated to separate them, and, in other cases, a section that would appear in the pdf navigation bar and in the TOC slide, but do not create the slide separating the sections (the code that I am using for making slides separating the sections is in the end of the question). I have called this a phantom section, but if there is a better name to call it, please edit the title of the question to help others to find this question.
One approach near to the desired behavior can be found in this question, but it does not adds the hyperlink to the correct slide number in the TOC and does not add the section to the pdf navigation bar. I tried adapting its code to work with sub(sub)sections:
\makeatletter
\newcommand{\phantomsectionfortoc}[1]{%%
\global\advance\beamer@tocsectionnumber by 1%%
\addtocontents{toc}{\protect\beamer@sectionintoc{0}{#1}{0}{0}%%
{\the\beamer@tocsectionnumber}}}
\makeatother
\makeatletter
\newcommand{\phantomsubsectionfortoc}[1]{%%
\global\advance\beamer@tocsubsectionnumber by 1%%
\addtocontents{toc}{\protect\beamer@subsectionintoc{0}{#1}{0}{0}%%
{\the\beamer@tocsubsectionnumber}}}
\makeatother
\makeatletter
\newcommand{\phantomsubsubsectionfortoc}[1]{%%
\global\advance\beamer@tocsubsubsectionnumber by 1%%
\addtocontents{toc}{\protect\beamer@subsubsectionintoc{0}{#1}{0}{0}%%
{\the\beamer@tocsubsubsectionnumber}}}
\makeatother
But it has the limitation of not working the hyperlink correctly. I would need to change the {0} inputs to point to the correct slide number. Besides, the sub(sub)section do not have any effect.
So, how would I be able to create phantom sections that would appear in TOC and in the pdf navigation bar, but do not create the separation slide?
Next I provide a starting code example. Suppose that Subsection1.2 ad Subsection2.1.1 shouldn't have a separation slide, how could that be achieved?
% Package options:
\PassOptionsToPackage{table,xcdraw}{xcolor}
\documentclass[table,svgnames,smaller,11pt]{beamer}
%% Add slide numbers
\newcommand*\oldmacro{}%%
\let\oldmacro\insertshorttitle%%
\renewcommand*\insertshorttitle{%%
\oldmacro\hfill%%
\insertframenumber\,/\,\inserttotalframenumber}
% For more themes, color themes and font themes, see:
\mode<presentation>
{
\usetheme{Berlin} % or try default, Darmstadt, Warsaw, Boadilla ...
\usecolortheme{default} % or try albatross, beaver, crane, ...
\usefonttheme{serif} % or try default, structurebold, ...
%\usefonttheme{professionalfonts} % or try default, structurebold, ...
%\usefonttheme{serif} % or try default, structurebold, ...
%\setmainfont{Helvetica}
\setbeamertemplate{caption}[numbered]
}
%----------------------PACKAGES-|-SEGAKCAP---------------------
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{multicol}
\usepackage{chemfig}
\usepackage{etoolbox}
\usepackage{moresize}
\usepackage[percent]{overpic}
\usepackage[version=3]{mhchem}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{anyfontsize}
%---------------END-OF-PACKAGES-|-SEGAKCAP-FO-DNE--------------
\title{Report}
\author{wsfreund@wsfreund-mac.local}
\institute{ATLAS Internal}
\date{\today}
\setbeamerfont{frametitle}{size=\small}
\useinnertheme{rounded}
\useoutertheme{smoothtree}
\setbeamertemplate{headline}
{%
\pgfuseshading{beamer@treeshade}%
\vskip-10.25ex%
\begin{beamercolorbox}[wd=\paperwidth,ht=2.125ex,dp=1.125ex,ignorebg,%
leftskip=.3cm,rightskip=.3cm plus1fil]{section in head/foot}
\usebeamerfont{section in head/foot}%
\insertsectionhead
\end{beamercolorbox}
\begin{beamercolorbox}[wd=\paperwidth,ht=2.125ex,dp=1.125ex,ignorebg,%
leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
\usebeamerfont{subsection in head/foot}%
\hskip6pt\insertsubsectionhead
\end{beamercolorbox}
\begin{beamercolorbox}[wd=\paperwidth,ht=2.125ex,dp=1.125ex,ignorebg,%
leftskip=.3cm,rightskip=.3cm plus1fil]{subsubsection in head/foot}
\usebeamerfont{subsection in head/foot}%
\hskip12pt\insertsubsubsectionhead
\end{beamercolorbox}
}
\defbeamertemplate{subsubsection in toc}{subsubsections numbered}
{\leavevmode\leftskip=3em%
\rlap{\hskip-3em\inserttocsectionnumber.\inserttocsubsectionnumber.\inserttocsubsubsectionnumber}%
\inserttocsubsubsection\par}
\setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{subsection in toc}[subsections numbered]
\setbeamertemplate{subsubsection in toc}[subsubsections numbered]
\AtBeginSection[]{
\frame<beamer>{
\frametitle{Outline}
\tableofcontents[
sectionstyle=show/shaded,
subsectionstyle=show/shaded/hide,
subsubsectionstyle=show/hide/hide/hide,
]
}
}
\AtBeginSubsection[]{
\frame<beamer>{
\frametitle{Outline}
\tableofcontents[
sectionstyle=show/shaded,
subsectionstyle=show/shaded/hide,
subsubsectionstyle=show/shaded/hide/hide
]
}
}
\AtBeginSubsubsection[]{
\frame<beamer>{
\frametitle{Outline}
\tableofcontents[
sectionstyle=show/shaded,
subsectionstyle=show/shaded/hide,
subsubsectionstyle=show/shaded/hide/hide
]
}
}
\begin{document}
%--------------------------------------------------------------
\titlepage
%--------------------- --------- -------- ---------------------
%--------------------- --------- -------- ---------------------
%--------------------- --------- -------- ---------------------
\section*{Outline}
%--------------------------------------------------------------
\begin{frame}
[allowframebreaks]
\frametitle{Outline}
\tableofcontents
\end{frame}
%--------------------- --------- -------- ---------------------
%--------------------- --------- -------- ---------------------
%--------------------- --------- -------- ---------------------
\section{Section1}
%--------------------- --------- -------- ---------------------
%--------------------- --------- -------- ---------------------
\subsection{Subsection1.1}
%--------------------------------------------------------------
\begin{frame}
\frametitle{Slide1}
\end{frame}
%--------------------------------------------------------------
\begin{frame}
\frametitle{Slide2}
\end{frame}
%--------------------- --------- -------- ---------------------
%--------------------- --------- -------- ---------------------
\subsection{Subsection1.2}
%--------------------------------------------------------------
\begin{frame}
\frametitle{Slide3}
\end{frame}
%--------------------------------------------------------------
\begin{frame}
\frametitle{Slide4}
\end{frame}
%--------------------- --------- -------- ---------------------
%--------------------- --------- -------- ---------------------
%--------------------- --------- -------- ---------------------
\section{Section2}
%--------------------- --------- -------- ---------------------
%--------------------- --------- -------- ---------------------
\subsection{Subsection2.1}
%--------------------- --------- -------- ---------------------
\subsubsection{Subsection2.1.1}
%--------------------------------------------------------------
\begin{frame}
\frametitle{Slide5}
\end{frame}
%--------------------- --------- -------- ---------------------
\subsubsection{Subsection2.1.2}
%--------------------------------------------------------------
\begin{frame}
\frametitle{Slide6}
\end{frame}
%--------------------- --------- -------- ---------------------
%--------------------- --------- -------- ---------------------
\subsection{Subsection2.2}
%--------------------------------------------------------------
\begin{frame}
\frametitle{Slide7}
\end{frame}
\end{document}