1

I would like to have an horizontal subsection navigation inside a vertical navigation bar.

The idea is to obtain the same subsection navigation as for the outersmoothbar but in a vertical navigation bar.

I look for it but cannot find any solution. Any idea ?

Elendil

Edit: I'm writing my theme and I put here the peace of code concerning the sidebar.

% ============================================================
% LENGTH
% ============================================================
\newlength{\SidebarWidth}
\setlength{\SidebarWidth}{\beamer@sidebarwidth}
\newlength{\HeadlineWidth}
\setlength{\HeadlineWidth}{\paperwidth}
\addtolength{\HeadlineWidth}{-\SidebarWidth}
\addtolength{\HeadlineWidth}{-1pt}
\newlength{\HeadlineHeight}
\settoheight{\HeadlineHeight}{\large TexTe}
\addtolength{\HeadlineHeight}{1ex}

% ============================================================
% SIDEBAR
% ============================================================
% color
\setbeamercolor{sidebar}{bg=white}
\setbeamercolor{section in head/foot}{fg=black, bg=white}

% sidebar itself
\setbeamertemplate{sidebar \beamer@sidebarside}
{
  \vfill
  \insertverticalnavigation{\beamer@sidebarwidth}%
  \vfill
}%

% vertical rule
\setbeamertemplate{sidebar canvas \beamer@sidebarside}{
  \vspace*{-0.7\HeadlineHeight}%
  \ifx\beamer@sidebarside\beamer@lefttext{%
    \hspace*{0.99\beamer@sidebarwidth}%
    \color{black}\rule{1pt}{0.9\paperheight}%
  }
  \else{%
    \color{black}\rule{1pt}{0.9\paperheight}%
  }
  \fi
}

% section in sidebar
\setbeamertemplate{section in sidebar}%{sidebar theme}
{%
  \vbox{%
    \vskip1ex%
    \beamer@sidebarformat{3pt}{section in sidebar}{
      \centering\tikz[opacity=1.0] \node[xshift=0cm,yshift=0cm] at (0,0) {\includegraphics[height=0.7\beamer@sidebarwidth]{obian/sec\expandafter\insertsectionheadnumber\expandafter}};%
    }%
  }%
}

% section in sidebar shaded
\setbeamertemplate{section in sidebar shaded}%{sidebar theme}
{%
  \vbox{%
    \vskip1ex%
    \beamer@sidebarformat{3pt}{section in sidebar}{
      \centering\tikz[opacity=0.3] \node at (0,0) {\includegraphics[height=0.7\beamer@sidebarwidth]{obian/sec\expandafter\insertsectionheadnumber\expandafter}};%
    }%
  }%
}

% Patch sidebar to not hide section when show subsection
\patchcmd{\insertverticalnavigation}%
{\ifx\beamer@nav@css\beamer@hidetext{\usebeamertemplate{section in sidebar}}\else{\usebeamertemplate{section in sidebar shaded}}\fi}%
{{\usebeamertemplate{section in sidebar}}}{}{}

And a simple example could be this one loading the previous code in the preamble:

\documentclass{beamer}

\begin{document}

\begin{frame}
  \titlepage
\end{frame}

\begin{frame}
\tableofcontents[subsectionstyle=show]
\end{frame}

\section{Section 1}
\begin{frame}
\begin{itemize}
\item No frametitle
\item section 1
\end{itemize}
\end{frame}

\subsection{Subsection 1}
\begin{frame}
\begin{itemize}
\item No frametitle
\item section 1
\item subsection 1
\end{itemize}
\end{frame}

\end{document}
  • 1
    Which theme are you using? Can you please provide a minimal document showing your current settings? – Gonzalo Medina Jun 21 '13 at 15:34
  • I'm writing my theme and code are large. But I add the part of code concerning the sidebar. – Elendil Jun 22 '13 at 7:39
1

Finally I found a solution by re-writing the internal macro \insertverticalnavigation. I put the code if it can help someone.

If you have any idea to improve, please let me know.

In a MyStyle.sty file I wrote:

% Style
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{MyStyle}[2013/06/21 Beamer theme]

% Outer theme
\useoutertheme[left]{sidebar}

% Package
\RequirePackage{wasysym} %\Circle, \CIRCLE -> subsection symbol

% Length
\newlength{\SidebarWidth}
\setlength{\SidebarWidth}{\beamer@sidebarwidth}

% Internal insertverticalnavigation macro
\def\insertverticalnavigation#1{%
  \begin{minipage}[t]{\SidebarWidth}
    \centering
    \vbox to \paperheight{%
      \def\sectionentry##1##2##3##4##5{%
        \ifnum##5=\c@part%
        \def\insertsectionhead{##2}%
        \def\insertsectionheadnumber{##1}%
        \def\insertpartheadnumber{##5}%
        \vskip0.9em
        \hbox{{%
          \usebeamerfont{section in sidebar}\usebeamercolor[fg]{section in sidebar}%
            \hyperlink{Navigation##3}{%
            \ifnum\c@section=##1%
              \ifnum\c@subsection=0\relax%
                {\usebeamertemplate{section in sidebar}}%
              \else%
                \ifx\beamer@nav@css\beamer@hidetext%
                  {\usebeamertemplate{section in sidebar}}%
                \else%
                  {\usebeamertemplate{section in sidebar}}%
                \fi%
              \fi%
            \else
              {\usebeamertemplate{section in sidebar shaded}}%
            \fi}}}%
        \vskip0pt
        \beamer@currentsubsection=0\relax\fi}%
      \def\slideentry##1##2##3##4##5##6{}%
      \def\beamer@subsectionentry##1##2##3##4##5{%
        \ifnum##1=\c@part%
        \def\insertpartheadnumber{##1}%
        \def\insertsectionheadnumber{##2}%
        \def\insertsubsectionheadnumber{##3}%
        \def\insertsubsectionhead{##5}%
         \beamer@tocifnothide{\ifnum\c@section=##2\ifnum\c@subsection=##3\beamer@nav@css\else\beamer@nav@oss\fi\else\beamer@nav@ooss\fi}%
        {\hskip0pt\hbox{{%
          \usebeamerfont{subsection in sidebar}\usebeamercolor[fg]{subsection in sidebar}%
            \hyperlink{Navigation##4}{%
            \ifnum\c@section=##2%
              \ifnum\c@subsection=##3%
                \ifnum\c@subsubsection=0\relax%
                  {\usebeamertemplate{subsection in sidebar}}%
                \else%
                  {\usebeamertemplate{subsection in sidebar}}%
                \fi%
              \else%
                {\usebeamertemplate{subsection in sidebar shaded}}%
              \fi%
            \else%
              {\usebeamertemplate{subsection in sidebar shaded}}%
            \fi}}}%
        }%
        \fi}%
      \dohead%
    }%
  \end{minipage}
}

% subsection in sidebar
\setbeamertemplate{subsection in sidebar}
{
  \usebeamercolor{subsection in sidebar}\CIRCLE%
}

% subsection in sidebar shaded
\setbeamertemplate{subsection in sidebar shaded}
{
  \usebeamercolor{subsection in sidebar shaded}\Circle%
}

And a MWE could be:

\documentclass{beamer}

\usepackage{MyStyle}

\begin{document}

\begin{frame}
  \titlepage
\end{frame}

\begin{frame}
\tableofcontents
\end{frame}

\section{Section 1}
\begin{frame}
\begin{itemize}
\item No frametitle
\item section 1
\end{itemize}
\end{frame}

\subsection{Subsection 1}
\begin{frame}
\begin{itemize}
\item No frametitle
\item section 1
\item subsection 1
\end{itemize}
\end{frame}

\subsection{Subsection 2}
\begin{frame}
\begin{itemize}
\item No frametitle
\item section 1
\item subsection 2
\end{itemize}
\end{frame}

\section{Section 2}
\begin{frame}
\begin{itemize}
\item No frametitle
\item section 2
\end{itemize}
\end{frame}

\end{document}

This little example provide me what I want which is subsection in horizontal mode inside a vertical navigation bar.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.