Application to remove ALL comments from pre-typeset LaTeX code

This posting may be useful at some distant point in the future for those using Scrivener+LaTeX. For a very odd reason, I searched for an application that would strip ALL comments from a pre-typeset LaTeX file, including, for example, code within a \begin{comment} … \end{comment} pair of statements, et al.

The application is very powerful for those of us that may have an overwhelming quantity of detritus comments, left behind after a long lost debugging episode, and want to clear the LaTeX air, so to speak. Not for everyone, but when you need something with this capability, it can be invaluable.

This amazing tool on the following website more or less automates the stripping of ALL comments from a LaTeX file:

I found the above link on StackExchange at:

Utility to Strip Comments from LaTeX Source

Amazing!!

It took me a while to go through the necessary updates (Python, et al.) to complete the arXiv LaTeX Cleaner installation, but after following the installation instructions, I ran the cleaner and ended up with a LaTeX Tex file COMPLETELY stripped of all comments. Wow!

Note: The arXiv LaTeX Cleaner requires Python 3 or later. BE SURE TO UPDATE prior to starting the arXiv LaTeX Cleaner installation. I didn’t and had to backtrack on the installation … annoying and a waste of time.

I am simply floored that there actually is a Python script out there to strip ALL comments from a LaTeX file … it reminds me of the AI in the movie ‘I, Robot’ who keeps telling Will Smith’s character … “You need to ask the right question to find the answer you seek…” or something to that effect!

Most Scrivener+LaTeX users likely will never need to use the arXiv LaTeX Cleaner to clear ALL comments from your LaTeX file, but if for some reason far in the future you need to do so, you can search the L&L Community Forum years from now to find how to do it.

Thanks for reading,
scrive
:thinking:

1 Like