Automattic / Automattic/harper

TeX: Inline math being ignored causes unnecessary false positives

Open
#3,613 0 comments 0 reactions 0 assignees View on GitHub
bug harper-core linting tex
Dominant language
Rust
Stars
15.4k
Forks
627
Avg merge
1d 15h
Merged PRs (30d)
102

Description

**What got flagged?**
```latex
\begin{document}
If $a+b=c$, then something else.
If something, then $x^2+y^2=z^2$.
\end{document}
```
The first line triggers "Don't use a space before a comma", while the second line triggers "Unnecessary space at the end of the sentence".

**Why is this incorrect?**
Inline math should be considered part of the text. It seems that the math element is just being ignored which leads to many false positives in math heavy texts.

**Example of correct usage:**
Instead of ignoring inline math it could be treated as a math object.

Contributor guide

Open the contributing guide

Research direction

Reproduce the two false positives using the LaTeX example in the issue, then trace how inline math is handled and why it is ignored. Done means inline math is treated as part of the surrounding text or as a math object, without triggering these incorrect spacing warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, tex
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.