
\tableofcontents
に次のテンプレートを作成したいと思いますbeamer
。
次のMWEを使用してsections
、およびのリストのコードを生成できます。subsections
\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}
しかし、縦線を挿入する賢い方法が見つかりません。background
テンプレートを使用すれば可能ですが、配置は簡単ではありません ( と に大きく依存しますaspectratio
) 。でもmargins
同じことが起こります。テンプレートを で囲み、各テンプレートをノードのコレクションとして定義する方法を見つけようとしましたが、思ったよりも複雑なようです。 たとえば、 を使用することは良い選択ではありません。overlay
tikzpicture
section in toc
tikzpicture
\tableofcontets
\patchcmd
答え1
ノードにラベルを付けて、最初のセクションから最後のセクションまで線を描くことができます。
\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}
最後のセクションにサブセクションを含める場合は、それらにもラベルを付けて、https://topanswers.xyz/tex?q=1987#a2230最後のサブセクション番号を調べます。