#latex #collaboration #cleanup #command #up #alice #clean

app collclean

Clean up collaboration commands in LaTeX files

7 unstable releases

0.4.2 Oct 6, 2024
0.4.1 Jan 27, 2023
0.3.0 Jan 5, 2023
0.2.1 Jan 5, 2023
0.1.0 Mar 18, 2022

#172 in Text processing

21 downloads per month

MIT license

19KB
406 lines

collclean

crates.io actively developed dependency status License: MIT/Apache-2.0

Usage

Consider a valid LaTeX file paper.tex, where several parts are marked by collaborators using \alice and \bob:

Lorem ipsum \alice{dolor sit amet, consetetur \b \bob {sadipscing} elitr, sed diam nonumy eirmod tempor 
invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.} At vero eos et accusam
et justo duo dolores et ea rebum. 
\[
    A = \min \{ B, \bob{C \} }
\]
% \alice{Lorem ipsum dolor sit amet
Stet clita kasd gubergren, \alice{no} sea takimata sanctus est Lorem ipsum dolor sit amet. 
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor 
invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam 
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus 
est Lorem {ipsum dolor sit amet.}

To remove these commands and the corresponding brackets, run

collclean paper.tex alice bob

The file paper.tex will then look like this:

Lorem ipsum dolor sit amet, consetetur \b sadipscing elitr, sed diam nonumy eirmod tempor 
invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. 
\[
    A = \min \{ B, C \} 
\]
% \alice{Lorem ipsum dolor sit amet
Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. 
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor 
invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam 
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus 
est Lorem {ipsum dolor sit amet.}

Options

  • Output to a different file (input file stays untouched): -o output.tex
  • Dry run (see remove comments in prompt; files stay unchanged): --dry
  • Line range (only remove marks which are completely inside range): --from <line> and --to <line>. One-sided ranges are also supported.

Further notes

  • The command definitions (e.g. via \newcommand) will not be removed.
  • Commented lines are ignored.
  • If the file is not valid, e.g., there are more opening brackets than closing brackets, the program stops and does not make changes.

Installation

After installing Rust, install collclean via cargo:

cargo install collclean

Dependencies

~1MB
~18K SLoC