WGUNDERWOOD / tex-fmt

An extremely fast LaTeX formatter written in Rust
MIT License
250 stars 19 forks source link

Indent count not compatible with open bracket #29

Closed Xiao-Chenguang closed 1 month ago

Xiao-Chenguang commented 1 month ago

I have some open bracket in my document like ( e.g. \big( in math mode, it turn out the tex-fmt count it as sign of increase indent. This is not expected behaviour, and seems to be related to https://github.com/WGUNDERWOOD/tex-fmt/blob/19e0bbdbab275b20dd20cfc7ed8cf4ab5a7cce2e/src/indent.rs#L65-L69 and https://github.com/WGUNDERWOOD/tex-fmt/blob/19e0bbdbab275b20dd20cfc7ed8cf4ab5a7cce2e/src/indent.rs#L79-L84 The code use the bracket match as sign of indent, which is not always true.

WGUNDERWOOD commented 1 month ago

Thanks for this! Can I ask why this is not expected behaviour? I generally like to have all parentheses indented (at least in math mode, see #28 for a related issue in text mode). I understand that this is not everyone's preference, but I hope to avoid introducing too much complexity or competing standards within tex-fmt.

Xiao-Chenguang commented 1 month ago

Sorry for the confusing in my descreption. indeed #28 is exactly the case I encounter. I understant your point of the format of parentness, let's close in support of #28