
\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
템플릿을 a 안에 넣고 tikzpicture
각 템플릿을 노드의 모음으로 정의하는 방법을 찾아보았 으나 \tableofcontets
생각보다 복잡한 것 같습니다. 예를 들어, using은 \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마지막 하위 섹션 번호를 알아냅니다.