Skip to content

Commit

Permalink
Update performance information in README
Browse files Browse the repository at this point in the history
  • Loading branch information
WGUNDERWOOD committed May 2, 2024
1 parent c8a4c0d commit e2ec121
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 26 deletions.
40 changes: 18 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ E = m c^2
</tr>
</table>

- ⚡ Very good run-time performance
- 🔧 No configuration necessary
- 📟 Command-line interface
- 📜 Handles LaTeX file types `.tex`, `.bib`, `.cls`, and `.sty`

## Installation

### Nix
Expand All @@ -69,34 +74,25 @@ nix build "github:wgunderwood/tex-fmt"
``` shell
cargo install --git "https://github.com/wgunderwood/tex-fmt"
```
## Aims

This project aims to provide a command-line tool for formatting
LaTeX source code files with the following properties:

- Handling of the common LaTeX file types `.tex`, `.bib`, `.cls`, and `.sty`
- Very good run-time performance
- No configuration necessary

It does *not* currently aim to provide the following:

- Semantic parsing of LaTeX code
- Linting or correction of syntax errors
- Customization via configuration files
- Compliance with existing formatting guidelines
- Editor integration
- Spell checking

## Performance

Run `perf.sh` to format all test cases in the `tests/` directory.
For larger files, tex-fmt is hundreds of times faster than latexindent.
Run `perf.sh` to format all test cases.
For large files, `tex-fmt` is hundreds of times faster than latexindent.

| **Files** | **Lines** | **Size** | **tex-fmt** | **latexindent** | **latexindent -m** |
| --- | --- | --- | --- | --- | --- |
| 6 | 30k | 900kb | **0.0362s** | 11.6s [x322] | 15.3s [x424] |
| 11 | 30k | 800kb | **0.0362s** | 12.0s [x333] | 15.9s [x439] |

## Limitations

- Semantic parsing of LaTeX code not conducted
- No linting or correction of syntax errors
- Customization via configuration files not supported
- Compliance with existing formatting guidelines not guaranteed
- Editor integration not currently provided
- No spell checking

## Comparison with existing tools
## Existing tools

- [latexindent](https://github.com/cmhughes/latexindent.pl).
Perl script, many configuration options, slow on large files.
Expand Down
3 changes: 0 additions & 3 deletions notes.org
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
* Tests
** Look for problem cases in other latex documents
* Features
** TODO Environments should start and end on new lines
*** New line before begin/end with regex replace
*** Care with comments
** Fold long lines to 80 characters
*** Care with trailing comments
*** No folding in verbatim environments, just warn
Expand Down
3 changes: 2 additions & 1 deletion perf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ for f in $DIR/*.tex; do
echo -n "$(wc -l $f | cut --delimiter=" " --fields 1) lines, "
echo "$(ls -sh $f | cut --delimiter=" " --fields 1)"
done
echo -n "Total: $(wc -l --total=only $DIR/*.tex) lines, "
echo -n "Total: $(ls -l $DIR/*.tex | wc -l) files, "
echo -n "$(wc -l --total=only $DIR/*.tex) lines, "
echo "$(ls -lh $DIR | head -n 1 | cut --delimiter=" " --fields 2)"
echo

Expand Down

0 comments on commit e2ec121

Please sign in to comment.