1

I know this title is a bit reccurent but I have not found any solution so far.

I'm currently working on creating my own beamer template. It would look basic but I'd like it to work as follows : when I create a section, the slide sees its headline with the section title (and its number) written on it on the left. Then if I create a subsection, the headline changes so the name (and number) of the subsection appears at the same height as the section title but on the left (I suppose there'll be a \hfill somewhere). Then, only in subsubsection, i'd like to add its name and number in another bar above the first one.

Now, I've checked multiple pages and this one almost solved my problem : Display beamer headline in frames conditional on section and subsection environments ... but almost. The point is that I don't fully understand the code so it becomes quickly really hard to customize it to achieve my goal.

Here is my actual code to try to make it work :

\usepackage{environ,substr} 
\newif\ifinsertsection 
\newif\ifinsertsubsection
\newif\ifinsertsubsubsection

\setbeamertemplate{headline}{
    \ifinsertsection
        \leavevmode
        \begin{beamercolorbox}[wd=\paperwidth,ht=8ex]{sec_subsec}
        \raggedright
        \hspace*{2em}
        {\color{main_bg}{\large\thesection.~\insertsection}}
        \vspace{0.15cm}
        \end{beamercolorbox}
        \fi
    \ifinsertsubsection
        \leavevmode
        \begin{beamercolorbox}[wd=\paperwidth,ht=8ex]{sec_subsec}
        \raggedright % justification à droite
        \hspace*{2em}% marge à gauche du titre dans le headline
        {\color{main_bg}{\large\thesection.~\insertsection
        \hfill %justification à gauche
        \small\thesection.\thesubsection.~\insertsubsection}}
        \vspace{0.15cm}%
        \end{beamercolorbox}
        \fi
    \ifinsertsubsubsection
        \leavevmode
        \begin{beamercolorbox}[wd=\paperwidth,ht=5ex]{subsubsec}
        \raggedright
        \hspace*{4em} 
        {\color{main_bg}{\small\thesection.\thesubsection.\thesubsubsection.~\insertsubsubsection}}
        \vspace{0.08cm}
        \end{beamercolorbox}    
        \fi
        \vspace{0.5cm}
}

\NewEnviron{beamersection}[2][]{%
  \IfSubStringInString{\detokenize{\subsubsection}}{\detokenize\expandafter{\BODY}}{\insertsubsubsectiontrue}{}
    \insertsubsectiontrue   
  \if\relax\detokenize{#2}\relax
    \section{#2}
  \else
    \section[#1]{#2}
  \fi
  \par\BODY
}

\begin{document}
\begin{beamersection}{Section 1}
\frame{
    You are in section 1
}
\subsection{Subsection 1}
\frame{
    You are in section 1, subsection 1
}
\subsubsection{Subsubsection 1}
\frame{
    You are in subsubsection 1
}
\subsection{Subsection 2}
\frame{
    You are in section 1, subsection 2
}
\end{beamersection}
\end{document}

And here is how slides actually look like: After creating a section

and here I'd like the 1.0. on the right top and the whole grey zone to disappear. Then after creating a subsection in section 1

After creating a subsection in section 1

and here same as before, i'd like the grey bar to disappear. Then if I create a subsubsection, after creating a subsubsection

And of course i'd like this to work for as many section/subsection/subsubsection as I need. Thanks in advance, and i apologize for the long text but I believe it's well explained at least.

2
  • Welcome to TeX.SE! Remember to include a minimal working example in your question. Also, be a bit clearer about what your question is. It sounds like the only thing you haven't accomplished is removing the gray bar, removing the headings on the top right corner, and some formatting of the section numbers? Nov 25, 2019 at 21:39
  • @dgoodmaniii thank you for your reply. I know this is not minimal at all but i feel like every other page i consult I see people asking for "concrete example" and more infos in general so I tried to do so, I apologize if I did it wrong. Yes I don't know how to remove the grey bar only out of subsubsections, as well as the useless numbers that appear to show a subsection or subsubsection that doesn't even exist.
    – Tiranyk
    Nov 25, 2019 at 21:44

0

You must log in to answer this question.

Browse other questions tagged .