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

Enhancements: todo styles and format hook #64

Open
rzach opened this issue Jan 22, 2023 · 3 comments
Open

Enhancements: todo styles and format hook #64

rzach opened this issue Jan 22, 2023 · 3 comments

Comments

@rzach
Copy link
Contributor

rzach commented Jan 22, 2023

I had some ideas on how implementing the idea to mark accomplished todos (1.7.3 in the manual).

The first idea is to provide a way to define todo styles which can be activated using a key. This can easily be accomplished using:

\newcommand*{\definetodostyle}[2]{%
    \define@key{todonotes}{#1}[]{%
        \setkeys{todonotes}{#2}}}

E.g., then you can say

\definetodostyle{done}{backgroundcolor={black!10},textcolor={black!60}}
\todo[done]{Stuff}

and the note will be greyed out. Or

\definetodostyle{done}{disable}

would simply suppress them. It can also be used as an alternative to defining new commands as suggested in 1.8.14.

A problem is that setkeys always sets the keys given by \presetkeys so if done is used after any other keys, it will overwrite them. So \todo[done,inline]{Stuff} will work but \todo[inline,done]{Stuff} wont.

This would take care of adding a done key that can change anything you can change with keys to todo. You might want to do something else, e.g., strike out the note or add a checkmark at the end. I'd suggest providing a format key that takes a command name as argument, and then use that command to typeset the text in the note and/or the list of todos. E.g.,

\todo[format=sout]{Stuff}

would strike out the text (with the ulem package), or you could do say

\newcommand{\checked}[1]{#1\ \checkmark}
\todo[format=checked]{Stuff}

to add a checkmark at the end. Combine with the above

\definetodostyle{done}{format=checked}

to make \todo[done]{Stuff} do the same.
I'm not sure if you'd prefer this to happen both in the LoT and the actual note, just the note, or have two different hooks (noteformat,lotformat).

Would be happy to implement, test, document, and send a pull request if interested.

@rzach rzach changed the title Enhancements: todo styles and pre/post hooks Enhancements: todo styles and format hook Jan 22, 2023
@henrikmidtiby
Copy link
Owner

Thanks for the detailed suggestion for improving the todonotes package.

I think that the idea and implementation of the definetodostyle is very elegant and useful. You are very welcome to send a pull request regarding this change, if possible please include a suggestion for updating the documentation as well.

I'd suggest providing a format key that takes a command name as argument, and then use that command to typeset the text in the note and/or the list of todos.

Regarding the format option, I think it is an interesting suggestion. Back in 2009 I added a textsize / size option to the package and todo command respectively. I remember that it was quite difficult to make it work as intended. I would love to see a suggestion for an implementation! Then we can discuss if it needs to be modified.

I'm not sure if you'd prefer this to happen both in the LoT and the actual note, just the note, or have two different hooks (noteformat,lotformat).

With respect to the naming the formatting options, I would suggest to use the following two format and lotformat. The main reason is that I try to keep the option names short.

@rzach
Copy link
Contributor Author

rzach commented Jan 28, 2023

Sent pull request for the first idea (user defined styles)

@rzach
Copy link
Contributor Author

rzach commented Jan 30, 2023

Also for the flexible formatting

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

2 participants