Skip to content
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

spell checker disabled after \$ in .tex file #627

Open
Easy121 opened this issue Sep 21, 2021 · 2 comments
Open

spell checker disabled after \$ in .tex file #627

Easy121 opened this issue Sep 21, 2021 · 2 comments

Comments

@Easy121
Copy link

Easy121 commented Sep 21, 2021

I am writing in .tex file in VSCode, and a part of my file looks like this:

\myquote{Fred estimated that the entire project would cost between \$8,500,000 and \$11,000,000 for the facility construction. That estimate included the cost of land, furnishings, and a sheltered connection to the hospital. When up and running, it was estimated that the net income would range between \$9,000 and \$12,000 per unit per year. The team estimated the \textbf{net cash flow} for the entire project to be around \$1,500,000 per year.}
The project selection procedure here is generally \textbf{financial-based}. The criteria used here is \textbf{Payback Model}, which emphasizes cash flows. \mypar
I would say it is quitsdfe common to estimate the initial investment and net cash flow of the years to come. The estimation is static and easy to obtain from the knowledge of facilities already established.

The quitsdfe in the third paragraph should be underlined as spelling mistake but it's not. However, after I deleting all the \$ in the first paragraph, the underline of quitsdfe is back on again.

I think it's kind of a bug and I can't find ways to deal with it. It's my first time raising an issue and I appreciate your help very much!

@Easy121 Easy121 changed the title VSC disabled after \$ in .tex file spell checker disabled after \$ in .tex file Sep 21, 2021
@Jason3S Jason3S transferred this issue from streetsidesoftware/vscode-spell-checker Sep 21, 2021
@Jason3S
Copy link
Collaborator

Jason3S commented Sep 21, 2021

@Easy121, I believe this is related to how the LaTeX dictionary defines macros to be ignored.

@Brandon-Johns
Copy link

I encountered this same error and tried to characterise it.

The error will occur if an unmatched $ is in a comment or even just by itself (though that would be a syntax error)

The error doesn't always occur when using \$. Was it partially fixed for this case?

Key characteristics

  • The error is only related to the presence of one or more unmatched $
  • If there are multiple unmatched $, then they are treated in pairs. Any spelling error inside a pair will missed, regardless of the presence of other matched pairs (e.g. $something$) within the unmatched pair
  • If there are an uneven number of unmatched $, then any spelling error after the last unmatched $ will be missed up until either the last $ in the document, or if there are no more, then until the end of the document

Example to demonstrate this behaviour

\documentclass{article}
\begin{document}
spellingerrorone $a$ spellingerrortwo

%Unmatched dollar 1 $

spellingerrorthree $b$ spellingerrorfour

% Unmatched dollar 2 $

spellingerrorfive $c$ spellingerrorsix

% Unmatched dollar 3 $

spellingerrorsevern $d$ spellingerroreight
\end{document}
  • spellingerrorone and spellingerrortwo are caught
  • spellingerrorthree and spellingerrorfour are missed because they are between Unmatched dollar 1 and Unmatched dollar 2
  • spellingerrorfive and spellingerrorsix are caught
  • spellingerrorsevern is missed because it is between Unmatched dollar 2 and the final $ in the document (of the $d$)
  • spellingerroreight is caught

Source of error

It seems that the error is related to the the ignoring everything inside of a maths expression. Everything between a pair of unmatched dollar signs is being treated as a big maths expression.

I don't quite understand how cspell works - is this the ignore? If it is, then making it detect if the $ is inside of a comment will at least partially fix the issue

"name": "LaTexMath",
"pattern": "/(?<!(?<!(?<!\\\\)\\\\)\\\\)[$][^$]*[$]/g",
"description": "Match against LaTex Math Macros"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants