8

In my document I am leaving %TODO comments in order to get back at them at some time. How can I generate a list of them with their relevant information in Kile 2.0?

4 Answers 4

8

To precise Andrey's answer:

The todonotes package allows to use \todo commands to leave TODO notes in your documents. They are then displayed in the margin in draft mode, and removed in final mode. You can also generate a dynamic list of TODO notes with \listoftodos.

1
7

Actually, Kile directly supports %TODO, %FIXME, and %TEST comments. There may be others, but none of them seem to be documented anymore.

Enter one of these and you will notice the syntax highlighting. To see all such comments in your TeX file or project look under the Structure tab in the side panel. You should see a tree of Sections, Figures, etc. with your todos and fixes at the top.

4
  • Excellent. This still works and should be more documented.
    – dorien
    Nov 23, 2014 at 21:26
  • Checking in Kile 2.9.93, at least the following ones are syntax-highlighted: %TODO, %FIXME, %BUG, %NOTE, %HACK, %WARNING. However, only TODO and FIXME are listed in the Structure tab. I wonder if the highlighted words are listed in a configuration file somewhere.
    – J. D.
    Jan 11, 2022 at 15:19
  • 1
    You can add %TEST to that list
    – J. D.
    Jan 14, 2022 at 13:25
  • 1
    I've done some more digging. It seems that the "syntax alerts" supported in Kile are the same as in the Kate editor. They are listed here: kate-editor.org/syntax/data/html/test-alerts.html The words are as follows. All of them are highlighted in Kile as of 2.9.93: ALERT ATTENTION DANGER HACK SECURITY BUG FIXME DEPRECATED TASK TODO TBD WARNING CAUTION NOLINT ### NOTE NOTICE TEST TESTING
    – J. D.
    Nov 29, 2022 at 15:53
5

A more low-level solution would be to use some grep magic. If your %TODO notes are all only one line long, then this would be as simple as running the following in your terminal:

grep -n '%TODO' file.tex

This would print out a list of the lines in file.tex including the pattern %TODO. The -n switch prints line numbers, making it easy to find the relevant lines.

If you have some multi-line %TODOs, then you can use the -A 5 switch to print 5 lines after each instance of %TODO:

grep -n -A 5 '%TODO' file.tex

Indeed, with a multi-file project, you can search for all %TODOs across multiple files by replacing file.tex with *.tex or some other suitable wildcard.

Oh, here's something cool you could do, you could write the %TODO list to a file, and then verbatiminput the file into your tex document.

grep -n '%TODO' file.tex > todo.tex

And then add:

\verbatiminput{todo.tex}

To the end of your main file. This requires the verbatim package. Presumably listings has its own way of doing this.

You could even strip out the %TODO part of each line of todo.tex and write it as an item into an itemize environment. This is left as an exercise for the reader.

3

Perhaps you should start leaving \todos instead!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .