Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/filipporanza/fast_patch
Automatically refactor Latex code
https://github.com/filipporanza/fast_patch
latex perl perl-script perl5 refactoring-tools script
Last synced: about 1 month ago
JSON representation
Automatically refactor Latex code
- Host: GitHub
- URL: https://github.com/filipporanza/fast_patch
- Owner: FilippoRanza
- License: gpl-3.0
- Created: 2018-11-14T16:55:31.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-22T17:58:31.000Z (about 6 years ago)
- Last Synced: 2024-10-13T11:43:02.508Z (2 months ago)
- Topics: latex, perl, perl-script, perl5, refactoring-tools, script
- Language: Perl
- Size: 29.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fast_patch
Automatically refactor Latex code## Usage
```
[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.### Command Line Options
| 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.|### Refactor Notes
fast_patch.pl automatically modifies file inplace. It starts from a
**correct** latex file an make it better:
1. Properly indent each block
2. Converts each perenthesis inside an *equation* or *align* block
into its equivalent with *\left* or *\rigth*:( for example becomes \left(
3. Apply given *MACROs*
### MACRO
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 format
*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.