Personalize o toc no beamer

Personalize o toc no beamer

Quero criar o seguinte modelo para o \tableofcontentsarquivo in beamer. insira a descrição da imagem aqui

Consigo gerar o código para a lista de sectionse subsectionscom o seguinte MWE

\documentclass{beamer}
\usepackage[english]{babel}
\usepackage{tikz}
\setbeamerfont{section in toc}{family*=qag, size=\large,series=\bfseries}
\setbeamerfont{subsection in toc}{size=\normalsize,series=\bfseries}
\setbeamertemplate{subsection in toc}{%
    \begin{tikzpicture}[outer sep=0pt, inner sep=0pt,line width=0pt]
        \path[use as bounding box] (0,0) rectangle (\textwidth,0);
        \node[anchor=base east] at (.7\textwidth,0) { \inserttocsubsection};
    \end{tikzpicture}
}
\setbeamertemplate{section in toc}{%
    \begin{tikzpicture}[outer sep=0pt, inner sep=0pt,line width=0pt]
        \path[use as bounding box] (0,0) rectangle (\textwidth,0);
        \node[anchor=base east] at (.7\textwidth,0) { \inserttocsection};
        \node[anchor=base west] at (.7\textwidth+4ex+2.2ex,0){\inserttocsectionnumber};
    \end{tikzpicture}
}
\begin{document}
\begin{frame}
\tableofcontents
\end{frame}

\section{First Section}
\section{Second Section}
\subsection{A subsection}
\begin{frame}{Some frame}
\end{frame}
\end{document}

Porém, não encontro uma maneira inteligente de inserir a linha vertical. Se eu usar o backgroundtemplate, consigo fazer, mas o posicionamento não é fácil (e depende fortemente do aspectratioe do margins). O mesmo acontece com overlayin tikzpicture. Tentei encontrar uma maneira de incluir os section in tocmodelos dentro de a tikzpicturee definir cada modelo como uma coleção de nós, mas parece \tableofcontetsmais complexo do que pensei. Por exemplo, usar \patchcmdnão é uma boa escolha.

Responder1

Você poderia rotular os nós e desenhar sua linha da primeira à última seção:

\documentclass{beamer}
\usepackage[english]{babel}
\usepackage{tikz}
\setbeamerfont{section in toc}{family*=qag, size=\large,series=\bfseries}
\setbeamerfont{subsection in toc}{size=\normalsize,series=\bfseries}
\setbeamertemplate{subsection in toc}{%
    \begin{tikzpicture}[outer sep=0pt, inner sep=0pt,line width=0pt]
        \path[use as bounding box] (0,0) rectangle (\textwidth,0);
        \node[anchor=base east] at (.7\textwidth,0) { \inserttocsubsection};
    \end{tikzpicture}
}
\setbeamertemplate{section in toc}{%
    \begin{tikzpicture}[outer sep=0pt, inner sep=0pt,line width=0pt,remember picture]
        \path[use as bounding box] (0,0) rectangle (\textwidth,0);
        \node[anchor=base east] (toc-\inserttocsectionnumber) at (.7\textwidth,0) { \inserttocsection};
        \node[anchor=base west] at (.7\textwidth+4ex+2.2ex,0){\inserttocsectionnumber};
    \end{tikzpicture}
}

\makeatletter
\apptocmd{\tableofcontents}{%
\begin{tikzpicture}[remember picture,overlay]
\draw[red,line width=0.1cm] ([xshift=4.1ex,yshift=2ex]toc-1.north east) -- ([xshift=4.1ex,yshift=-2ex]toc-\the\[email protected] east);
\end{tikzpicture}%
}{}{}
\makeatother

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

\section{First Section}
\begin{frame}
\frametitle{Some frame}
\end{frame}
\section{Second Section}
\subsection{A subsection}
\begin{frame}
\frametitle{Some frame}
\end{frame}
\section{Third Section}
\begin{frame}
\frametitle{Some frame}
\end{frame}
\end{document}

insira a descrição da imagem aqui

Se sua última seção incluir subseções, você também pode rotulá-las e usarhttps://topanswers.xyz/tex?q=1987#a2230para descobrir o último número da subseção.

informação relacionada