
Quero criar o seguinte modelo para o \tableofcontents
arquivo in beamer
.
Consigo gerar o código para a lista de sections
e subsections
com 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 background
template, consigo fazer, mas o posicionamento não é fácil (e depende fortemente do aspectratio
e do margins
). O mesmo acontece com overlay
in tikzpicture
. Tentei encontrar uma maneira de incluir os section in toc
modelos dentro de a tikzpicture
e definir cada modelo como uma coleção de nós, mas parece \tableofcontets
mais complexo do que pensei. Por exemplo, usar \patchcmd
nã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}
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.