From 646143802eb7bfb7dd935c8baae28b6f38b293f7 Mon Sep 17 00:00:00 2001 From: sgerwk Date: Thu, 10 May 2018 01:13:39 +0200 Subject: [PATCH] newlines are like spaces in math inline mode TeX treats newlines as spaces when in inline math, except that empty lines cause errors. In other words, a correct latex file never contains two consecutive newlines, and a single newline is considered like a space in inline math. Without this commit, two newlines in an line math formula create an empty line. These are treated like paragraph endings, and therefore sentence endings, by LanguageTool. --- detex.l | 2 +- test/correct.txt | 2 ++ test/in.tex | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/detex.l b/detex.l index 26d4005..aac2ae2 100644 --- a/detex.l +++ b/detex.l @@ -365,7 +365,7 @@ VERBSYMBOL =|\\leq|\\geq|\\in|>|<|\\subseteq|\subseteq|\\subset|\\supset|\\sim|\ "$" /* math mode */ {BEGIN Math; NOUN;} "$" BEGIN Normal; -"\n" NEWLINE; +"\n" ; "\\$" ; {VERBSYMBOL} VERBNOUN; . ; diff --git a/test/correct.txt b/test/correct.txt index 83acc1c..0788ba0 100644 --- a/test/correct.txt +++ b/test/correct.txt @@ -59,6 +59,8 @@ Line ending with macro should not eat an empty newline +An inline math equation like should not produce an empty line + Text to include. diff --git a/test/in.tex b/test/in.tex index d545f29..082a459 100644 --- a/test/in.tex +++ b/test/in.tex @@ -99,6 +99,10 @@ \chapter*{First} should not eat an empty newline +An inline math equation like $a + +b + +c$ should not produce an empty line + \input{part} \newcounter{equation}