WGUNDERWOOD / tex-fmt

An extremely fast LaTeX formatter written in Rust
MIT License
272 stars 20 forks source link

Reduce the number of passes #7

Closed WGUNDERWOOD closed 3 months ago

WGUNDERWOOD commented 3 months 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 3 months ago

Working on this in the one-pass branch.

WGUNDERWOOD commented 3 months ago

Implemented in 958940507651a61fa4b3c9fa92e9fea8fe577509