WGUNDERWOOD / tex-fmt

An extremely fast LaTeX formatter written in Rust
MIT License
122 stars 10 forks source link

Reduce the number of passes #7

Closed WGUNDERWOOD closed 1 week ago

WGUNDERWOOD commented 4 weeks ago

The current approach alternates between indenting (adding spaces at the start of lines) and wrapping (inserting line breaks to shorten long lines) until convergence. This can result in multiple passes, which involves a lot of redundant work. It should be possible to reduce the number of required passes, ideally to a single pass through the file (possibly with some backtracking).

WGUNDERWOOD commented 4 weeks ago

Working on this in the one-pass branch.

WGUNDERWOOD commented 1 week ago

Implemented in 958940507651a61fa4b3c9fa92e9fea8fe577509