I add a command-line option (--commands_only_to_delete) to delete user-defined LaTeX commands but retain the text wrapped in the commands. This is useful for commands that are meant to temporarily change text colors and formats (e.g., some user-defined \red command that makes the text red), which are common in collaborative writing to highlight different people's texts. Such commands should be removed upon submissions but the text within ought to be retained.
Usage
Usages are exactly the same as --commands_to_delete. Note that if the commands listed here duplicate that after commands_to_delete, the default action will be retaining the wrapped text.
Modification
__main__.py: add an option and related help text.
arxiv_latex_cleaner.py: add an optional parameter to the _remove_command function, and keep (or not) the text accordingly.
arxiv_latex_cleaner_test.py: add unit test cases for test_remove_command
tex/main.tex: add integration test.
Btw, I fix a small bug regarding the _search_reference function. I find that picture references in LaTeX are allowed to be in different cases compared to the actual file names. So it's safer to add a re.IGNORECASE when doing re.search.
Motivation
I add a command-line option (--commands_only_to_delete) to delete user-defined LaTeX commands but retain the text wrapped in the commands. This is useful for commands that are meant to temporarily change text colors and formats (e.g., some user-defined \red command that makes the text red), which are common in collaborative writing to highlight different people's texts. Such commands should be removed upon submissions but the text within ought to be retained.
Usage
Usages are exactly the same as --commands_to_delete. Note that if the commands listed here duplicate that after commands_to_delete, the default action will be retaining the wrapped text.
Modification
__main__.py
: add an option and related help text.arxiv_latex_cleaner.py
: add an optional parameter to the_remove_command
function, and keep (or not) the text accordingly.arxiv_latex_cleaner_test.py
: add unit test cases fortest_remove_command
tex/main.tex
: add integration test.Btw, I fix a small bug regarding the
_search_reference
function. I find that picture references in LaTeX are allowed to be in different cases compared to the actual file names. So it's safer to add are.IGNORECASE
when doingre.search
.