Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFE] a todo list organized by chapter/section could be useful #30

Open
atrent opened this issue Jul 10, 2018 · 3 comments
Open

[RFE] a todo list organized by chapter/section could be useful #30

atrent opened this issue Jul 10, 2018 · 3 comments

Comments

@atrent
Copy link

atrent commented Jul 10, 2018

(but I don't know the implementation complexity)

@antonfrancois
Copy link

I agree !

@antonfrancois
Copy link

I found an easy workaround simply by putting \thesection command in a wrapper like so :
\newcommand{\todome}[1]{\todo[color=SpringGreen]{$\bullet$ \thesection: #1}}

@henrikmidtiby
Copy link
Owner

You might want to do something like this.

\documentclass{article}
\usepackage{todonotes}
\usepackage{xparse}

\makeatletter
\let\original@section=\section
\RenewDocumentCommand\section{s O{} m}{%
  \IfBooleanTF{#1}{%
    \original@section*{#3}%
  }{%
    \original@section{#3}%
    \addcontentsline{tdo}{section}{\thesection{} #3}
  }
}
\makeatother

\begin{document}
\section{A}
\todo{First todo}
\section{C}
\section{B}
\todo{Second todo}

\vfill
\listoftodos
\end{document}

I tried to use the latex hook mechanism, as shown below, but it repeated the section entries in the listoftodos.

\makeatletter
\AddToHook{cmd/section/before}{\addcontentsline{tdo}{section}{section}}
\makeatother

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants