area / language-latex

Syntax highlighting for LaTeX for Atom.
Other
78 stars 47 forks source link

Applied on non tex files (.lhs) #93

Closed estebanlan closed 7 years ago

estebanlan commented 7 years ago

I was working in an .lhs file (using language-haskell) and if I have language-latex enabled the $ and the ` affect the syntax coloring

languagelatex
yudai-nkt commented 7 years ago

This package does nothing about Haskell-related files. I've just installed language-haskell and tried your snippet, but the appearances are much the same. Is "Literate Haskell" grammar selected in your .lhs file?

> data FieldElem = FE2 F2 | FE3 F3 | FE4 F4 | FE7 F7 deriving (Show,Ord,Eq)

> f :: Int -> Int -> FieldElem
> f k 2 = FE2 $ F2 k
> f k 3 = FE3 $ F3 k
> f k 4 = FE4 $ F4 k

with language-latex enabled: enabled

with language-latex disabled: disabled

estebanlan commented 7 years ago

Checked it out, turns out it is only active when the code is not active (has a > at the beginning). Therefore, if in the non code part of an .lhs has a $ or a `, this happens. Toggled language-latex on and off and it solved the problem

langua-latex
yudai-nkt commented 7 years ago

OK, I could reproduce the problem. Although I'm not familiar with Literate Haskell or even Haskell itself (maybe the former is something related to literate programming?), it seems to be a probelm of language-haskell as it contains some LaTeX-related code.

yudai-nkt commented 7 years ago

As can be seen in atom-haskell/language-haskell#93, the line This is how this looks until I do this $ is invalid not only for LaTeX but for lhs2TeX also. Hence, we won't cope with this point. Please avoid using such invalid input or syntax.

Regarding the backtick, it's a duplicate of #87, which is also quite similar to #61. So I'll close this issue and please subscribe the threads above if you get interested in what's going on.