Beeminder Forum

I made a (todo) scanner for LaTeX

Use it to find all these \todo{}s and other things you missed!
The readme got an example for how to use it to find duplicate \emph{}s. Something I always struggled with.

I made it so you can hook the output up to other tools for e.g. automatic beeminding of the \todo{}s left in your .tex sources.

Check it out here:

2 Likes

I failed to point out that not only is this tool fast¹, it also handles commands spanning over multiple lines²:

This is \emph{very
great} indeed!

\emph{very

absolutely

awesome}.

produces (when invoked with emph as parameter):

very great
very absolutely awesome

which you can feed to, say, wc -l which gives you the number of lines, so 2 in this case.

¹ It’s scanning all your .tex files in parallel, taking full advantage of your CPU cores. Which is completely irrelevant because 99% is JVM startup time. Which could be alleviated by compiling to a native jvm-free image with sbt graalvm-native-image:packageBin except that it currently does not work because I’m using Scala 2.13.1 and they don’t yet support that.

² This got the (theoretical) downside that it keeps the entire file in memory instead of just the current line. I was considering using memory mapped files but since .tex files are stored mostly in UTF-8 and JVM Strings are UTF-16 this would probably do more harm than good. Also my largest .tex is 68 kiB so, yeah, very theoretical problem.