Beamer의 할 일 목록

Beamer의 할 일 목록

다음 MWE에서는 전체 프레젠테이션에 대한 할 일 목록으로 첫 번째 프레임을 넣으려고 합니다. 그런데 오류가 발생했습니다.

정의되지 않은 제어 순서. \contentsline

그렇다면 이 코드에서 무엇이 잘못되었나요?

\documentclass{beamer}
\usetheme{metropolis}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{todonotes}

\title{Title}
\author{Author}

\begin{document}

\begin{frame}{List of Todos}
    \listoftodos
\end{frame}

\maketitle

\begin{frame}{Table of contents}
    \setbeamertemplate{section in toc}[sections numbered]
    \tableofcontents[hideallsubsections]
\end{frame}

\section{Section 1}
\begin{frame}
    \todo[inline]{1st ToDo}
\end{frame}

\section{Section 2}
\begin{frame}
    \todo[inline]{2nd ToDo}
\end{frame}

\end{document}

답변1

모든 기능이 필요하지 않은 경우에는 todonotes몇 가지 기본 기능을 직접 구현하면 됩니다.

\documentclass{beamer}
\usetheme{metropolis}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{tcolorbox}

\newcounter{todo}
\newtcbox{\mytodobox}{colback=orange,colframe=orange!75!black}

\newcommand\todo[1]{%
    \refstepcounter{todo} 
    \mytodobox{\hypertarget{todo\thetodo}{#1}}
    \addcontentsline{tod}{subsection}{\protect\hyperlink{todo\thetodo}{\thetodo~#1}\par} 
}%

\makeatletter
\newcommand\listoftodos{%
    \@starttoc{tod}}
\makeatother

\title{Title}
\author{Author}

\begin{document}

    \begin{frame}{List of Todos}
        \listoftodos
    \end{frame}

    \maketitle

    \begin{frame}{Table of contents}
        \setbeamertemplate{section in toc}[sections numbered]
        \tableofcontents[hideallsubsections]
    \end{frame}

    \section{Section 1}
    \begin{frame}
        \todo{1nd ToDo}
    \end{frame}

    \section{Section 2}
    \begin{frame}
        \todo{2nd ToDo}
    \end{frame}

\end{document}

여기에 이미지 설명을 입력하세요

관련 정보