Beamer の Todo リスト

Beamer の Todo リスト

次のMWEでは、プレゼンテーション全体の最初のフレームをToDoリストとして配置しようとしています。しかし、エラーが発生しました。

未定義の制御シーケンス。\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}

ここに画像の説明を入力してください

関連情報