-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Incorrect formatting when using \left\{
and \right.
causing unexpected tabbing issues
#72
Comments
Hi @Charle4, I agree with you that I just wanted to point out that you seem to be trying to produce output that could be achieved with the \[
f(x) =
\begin{cases}
g(x), & \text{if } x \geq 0, \\
h(x), & \text{otherwise.}
\end{cases}.
\] |
Hi @cdesaintguilhem, Thank you for taking the time to respond and for considering looking into this unintended behavior. I really appreciate your efforts in maintaining You are absolutely correct that the Thank you again for considering this, and please let me know if I can provide further examples or clarify anything further. |
Thanks for this discussion; this is an interesting case. I see the argument for expecting
As far as I know, this is the typical use case for |
Well, maybe it makes no difference to match \left\{
…
\right.
\left.
…
\right\} Besides, LaTeX Workshop in VS Code just matches |
Can confirm this issue. Is there some temporary workaround? I'd like to keep tex-fmt elsewhere. Right now it just sets all my indents to 0. |
@Binero You can add Or you can use |
It appears that
tex-fmt
has an issue when handling the combination of\left\{
and\right.
. When these are used together in a math environment, the formatter fails to correctly recognize the environment closure. This results in unexpected additional tabs in subsequent lines of the document.This issue is particularly problematic in documents with multiple occurrences of this pattern, as the incorrect tabbing propagates, making the document increasingly misaligned and harder to read.
Using the following minimal working example (MWE), the issue can be reproduced:
After formatting this code with
tex-fmt
, the last two lines inside thealigned
environment are incorrectly indented. Furthermore, all subsequent content in the document is shifted to the right by an additional tab.Changing
\right.
to\right\}
resolves the tabbing issue, confirming that the problem lies in the formatter's failure to recognize the closure of\left
when paired with\right.
. The formatter should properly interpret\left\{
and\right.
as a valid delimiter pair, which is a legitimate LaTeX syntax, ensuring that the subsequent lines are not misaligned.This bug is particularly disruptive in documents with multiple instances of
\left\{ ... \right.
, as the issue compounds with each occurrence, requiring extensive manual intervention to fix. Thank you for investigating this issue and improving the usability oftex-fmt
!The text was updated successfully, but these errors were encountered: