arxiv-latex-cleaner
arxiv-latex-cleaner copied to clipboard
Feature request: more universal and robust comments deletion?
This example is helpful considering various scenarios when deleting comments in tex files. And I show the example below:
\begin{document}
hello world
% comment after %
20\% just a percent
new line \\%still a comment
\begin{comment}
comment even without percent % haha
\end{comment}
\begin{verbatim}
% not a comment though with %
\end{verbatim}
\end{document}
after document
In current version of this script:
-
No support for verbatim package. Since every char within verbatim env is not comment even with %.
-
Cannot delete comment directly attached after the newline
\\
, it will recognize\\%
as\ \%
where\%
is just a percent symbol instead of the beginning of comment. -
Maybe it is also relevant to delete everything below
\end{document}
since they would never be involved with the file.
1, 3 are more like feature requests while I think it would be better to fix 2.
Hi @refraction-ray Thanks for the example and for pointing out current limitations! I'll mark this issue as 'enhancement' for 1 and 3, bug for 2. In any case, I always recommend quickly checking the output code to see if some comment has been missed.
You could have a look at #31, which introduces a general regex replacement pipeline. You could use this feature to build a multi-line regular expression for your comment string and replace it with an empty string (""
).
pattern : '(:?\\begin{verbatim}\s*.*\s*\\end{verbatim})'
insertion: ''
Of course, don't nail me down on that regex pattern which I just improvised, but I think you get the gist.