Automatically refactor Latex code
[perl] fast_patch.pl [options...] [latex_file...]
This script modify inplace all given latex files. The update version has the ORIGINAL name while a backup version is also created. Backup is named ORIGINAL.bak . ORIGINAL is the name of the current input file.
Argument | Effect |
---|---|
--verbose | enables verbose mode |
--auto | find, and refactor, all .tex file in current directory and all its subdirectories, others file given from command line are ignored |
--label | Automatically add a label under 'section', 'subsection', 'subsubsection' and 'chapter'. Label marker is based on section/chapter name. The new label is added only if needed. |
fast_patch.pl automatically modifies file inplace. It starts from a correct latex file an make it better:
-
Properly indent each block
-
Converts each perenthesis inside an equation or align block into its equivalent with \left or \rigth:
( for example becomes \left(
-
Apply given MACROs
User can optionally add a file named macro.txt into the working directory. In this file the user can specify some macros the fast_patch.pl will add to each line. The user must pay attention to the macro names: if a name collides a latex command this will be overwritten.
macro.txt is a line based file, each line contains a macro:
a macro has the following format
NAME 'VALUE'
or
NAME "VALUE"
fast_patch.pl will search for each occurrence of each NAME and replace it with the proper VALUE.
Lines that starts with '#' are considerd comments and are ignored.