# How can I view all the %TODO comments I have marked using Kile?

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?

-

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.

-
an alternative would be the fixme package –  matth Jun 15 '12 at 9:13

Actually, Kile directly supports both a %TODO comment and a %FIXME comment. 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.

-
Excellent. This still works and should be more documented. –  dorien Nov 23 '14 at 21:26

Perhaps you should start leaving \todos instead!

-

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


\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.