todonotes: 할 일 목록에 장 헤더 삽입

todonotes: 할 일 목록에 장 헤더 삽입

패키지 의 경우 todonotes할 일 목록 안에 장 헤더를 삽입하여 해당 장 아래에 그룹화하는 방법을 알고 싶습니다.

\documentclass{book}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[hidelinks,colorlinks=false]{hyperref}
\usepackage{todonotes,lipsum}


\begin{document}

    \listoftodos

    \chapter{1st Chapter}
    \lipsum[1]
    \todo[inline]{1st todo}

    \chapter{2nd Chapter}
    \lipsum[2]
    \todo[inline]{2nd todo}

\end{document}

답변1

문서의 서문(예: 앞에 \begin{document})에 추가할 수 있습니다.

\makeatletter
\let\ori@chapter\@chapter
\def\@chapter[#1]#2{\ori@chapter[#1]{#2}%
  \if@mainmatter\addcontentsline{tdo}{chapter}{\protect\numberline{\thechapter}{#1}}%
  \else\addcontentsline{tdo}{chapter}{#1}%
  \fi}
\makeatother

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

관련 정보