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

\O in math mode results in corrections #216

Closed
stakaz opened this issue Jan 11, 2021 · 5 comments
Closed

\O in math mode results in corrections #216

stakaz opened this issue Jan 11, 2021 · 5 comments
Assignees
Labels
1-bug 🐛 Issue type: Bug report (something isn't working as expected) 2-confirmed Issue status: Confirmed, reproducible bug in LTeX 3-fixed Issue resolution: Issue has been fixed on the develop branch
Milestone

Comments

@stakaz
Copy link

stakaz commented Jan 11, 2021

Describe the bug
Despite these settings are set:

"ltex.latex.environments": {
   "align": "ignore"
   "boxedalign": "ignore"
},

The environments get still corrected by LTeX.

image

Expected behavior
Ignored environments should not be checked for errors.

Sample document
If the bug occurs for a specific document (e.g. LaTeX), please paste it here. If your document is very long or confidential, please create and attach a smaller example for which the bug still occurs so that we can reproduce it.

\begin{document}

\begin{align}
	AAAA + yyyy = zzzz
\end{align}

\begin{boxedalign}
	AAAA + yyyy = zzzz
\end{boxedalign}

\end{document}

LTeX configuration
Please paste all configuration settings starting with ltex. from your settings.json. You can help us by temporarily removing some irrelevant settings from your settings.json and see if the bug still occurs.

{
	"ltex.additionalRules.motherTongue": "de-DE",
	"ltex.additionalRules.languageModel": "~/languagetools/",
	"ltex.latex.commands": {
		"\\cref{}": "dummy",
		"\\citeauthor{}": "dummy",
		"\\subref{}": "dummy",
		"\\lcnamecref{}": "dummy",
		"\\subimport*{}{}": "ignore",
		"\\namecref{}": "dummy",
		"\\setmathfont[]{}": "ignore",
		"\\setmathfont{}": "ignore",
		"\\NewEnviron{}": "ignore",
		"\\setlength": "default",
		"\\numberwithin{}{}": "dummy",
		"\\renewcommand*": "default",
		"\\TODOref": "dummy",
		"\\TODOmark{}": "ignore"
	},
	"ltex.enabled": [
		"latex"
	],
	"ltex.latex.environments": {
		"align": "ignore",
		"boxedalign": "ignore"
	},
}

"LTeX Language Server" log file
First, reproduce the bug. Then, go to ViewOutput and select LTeX Language Server in the drop-down list. Paste this log here:

FINE: Checking the following text in language 'en-US' via LanguageTool: " Dummy0 \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
Jan 11, 2021 1:33:37 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FINE: Obtained 0 rule matches

"LTeX Language Client" log file
First, set the ltex.trace.server setting in your settings.json to "verbose". Then, reload the VS Code window and reproduce the bug. Go to ViewOutput and select LTeX Language Client in the drop-down list. Paste this log here (note: it will contain your checked document):

2021-01-11T12:07:57.519Z Info: Setting LTeX UI language to 'en-us'.
2021-01-11T12:07:57.519Z Info: Loading i18n messages...
2021-01-11T12:07:57.520Z Info: Loading default i18n messages...
2021-01-11T12:07:57.522Z Info: 
2021-01-11T12:07:57.522Z Info: ltex.ltex-ls.path not set.
2021-01-11T12:07:57.522Z Info: Searching for ltex-ls in '/home/gluon/.vscode-oss/extensions/valentjn.vscode-ltex-8.2.0/lib'...
2021-01-11T12:07:57.523Z Info: ltex-ls found in '/home/gluon/.vscode-oss/extensions/valentjn.vscode-ltex-8.2.0/lib/ltex-ls-9.0.0'.
2021-01-11T12:07:57.523Z Info: 
2021-01-11T12:07:57.524Z Info: ltex.java.path not set.
2021-01-11T12:07:57.524Z Info: Using ltex-ls from '/home/gluon/.vscode-oss/extensions/valentjn.vscode-ltex-8.2.0/lib/ltex-ls-9.0.0'.
2021-01-11T12:07:57.524Z Info: Using Java from PATH or JAVA_HOME (may fail if not installed).
2021-01-11T12:07:57.654Z Info: Testing ltex-ls...
2021-01-11T12:07:57.654Z Info:   Command: "/home/gluon/.vscode-oss/extensions/valentjn.vscode-ltex-8.2.0/lib/ltex-ls-9.0.0/bin/ltex-ls"
2021-01-11T12:07:57.654Z Info:   Arguments: ["--version"]
2021-01-11T12:07:57.654Z Info:   env['JAVA_HOME']: undefined
2021-01-11T12:07:57.654Z Info:   env['JAVA_OPTS']: "-Xms64m -Xmx512m"
2021-01-11T12:07:57.864Z Info: Test successful!
2021-01-11T12:07:57.865Z Info: 
2021-01-11T12:07:57.869Z Info: Starting ltex-ls...
2021-01-11T12:07:57.869Z Info:   Command: "/home/gluon/.vscode-oss/extensions/valentjn.vscode-ltex-8.2.0/lib/ltex-ls-9.0.0/bin/ltex-ls"
2021-01-11T12:07:57.869Z Info:   Arguments: []
2021-01-11T12:07:57.869Z Info:   env['JAVA_HOME']: undefined
2021-01-11T12:07:57.869Z Info:   env['JAVA_OPTS']: "-Xms64m -Xmx512m"
2021-01-11T12:07:57.869Z Info: 
2021-01-11T12:08:00.465Z Info: Started watching external setting file '/media/DATA/PhD/writing/PhD_Thesis/.vscode/ltex.dictionary.en-US.txt'.
2021-01-11T12:08:00.488Z Info: Started watching external setting file '/media/DATA/PhD/writing/PhD_Thesis/.vscode/ltex.hiddenFalsePositives.en-US.txt'.

Version information
List here the version information of the relevant software.

  • Operating system: Arch Linux
  • VS Code: 1.52.1
  • vscode-ltex: 8.2
@stakaz stakaz added 1-bug 🐛 Issue type: Bug report (something isn't working as expected) 2-unconfirmed Issue status: Bug that needs to be reproduced (all new bugs have this label) labels Jan 11, 2021
@valentjn
Copy link
Owner

valentjn commented Jan 11, 2021

I can't reproduce this. With the provided sample document and configuration on a vanilla* VS Code 1.52.1, I get no errors with LTEX 8.2.0. The provided server log contains Obtained 0 rule matches, so indeed, there should be no errors. (* the only extensions were German Language Pack for Visual Studio Code 1.52.2, LaTeX Workshop 8.15.0, and LTeX 8.2.0)

Maybe a different configuration (or document?) than the provided one has been used for creating the server log. Can you temporarily clear all settings (even all of the non-LTEX settings and all of the native VS Code settings) from your settings.json and only use the settings in your settings.json that are given under LTeX configuration in the issue description? Do the errors persist then? Use a new window without any open folder or workspace to be sure that no other settings are interfering.

Another possibility is that these underlined diagnostics come from another extension, and not from LTEX. What message is displayed when you hover with your mouse over the errors?

@valentjn valentjn added the 2-needs-info Issue status: We need more information (usually) from the submitter before continuing label Jan 11, 2021
@stakaz
Copy link
Author

stakaz commented Jan 11, 2021

Hello, I am very sorry, the example I gave here was an attempt to create a short case, but it was indeed another spell checking extention which produced the error. However, Ltex does have an issue here. But it is different one: when using two \O custom commands. The example is:

\documentclass{report}
\usepackage{amsmath}
\renewcommand{\O}{O}

\begin{document}
\begin{align}
	here are more symbols
\end{align}

\begin{align}
	\O here are more symbols \O
\end{align}

\begin{align}
	\O \O
\end{align}

\begin{align}
	\O here are \O \O more symbols \O
\end{align}
\end{document}

which results in:

image

with the message: 'Ø': Possible spelling mistake found.LTeX - MORFOLOGIK_RULE_EN_US

The number of Ø depends on the number of nested \Os.

Adding \O to ignored commands does not help.

Can you reproduce this?

P.S. I had a document with a lot of \O so it looked like every algin environment gets checked. However, I have edited with LTex for a while now and always used the \O and never had this issue, so it must be a regression in the last couple of versions.

Here is the log:

Jan 11, 2021 9:42:48 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FINE: Checking the following text in language 'en-US' via LanguageTool: " \n\nDummy0 \n\n\u00D8\u00D8 Dummy1 \n\n\u00D8\u00D8 Dummy2 \n\n\u00D8\u00D8\u00D8\u00D8 Dummy3 "
Jan 11, 2021 9:42:48 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FINE: Obtained 3 rule matches

@valentjn valentjn removed the 2-needs-info Issue status: We need more information (usually) from the submitter before continuing label Jan 12, 2021
@stakaz stakaz changed the title align and also other custom defined ignore environments get corrected text between two redefined \O commands in align environments gets corrected Jan 12, 2021
@valentjn valentjn added 2-confirmed Issue status: Confirmed, reproducible bug in LTeX and removed 2-unconfirmed Issue status: Bug that needs to be reproduced (all new bugs have this label) labels Jan 12, 2021
@valentjn valentjn self-assigned this Jan 12, 2021
@valentjn valentjn changed the title text between two redefined \O commands in align environments gets corrected \O in math mode results in corrections Jan 12, 2021
@valentjn valentjn added this to the 8.2.1 milestone Jan 12, 2021
@valentjn
Copy link
Owner

Ah yes, this is a bug. Accent commands like \O, \'e, etc. (which are internally replaced by LTEX with the corresponding Unicode characters when used in text mode) would not be ignored when used in math mode. This should be fixed now. Thanks for the report!

@valentjn valentjn added the 3-fixed Issue resolution: Issue has been fixed on the develop branch label Jan 12, 2021
@stakaz
Copy link
Author

stakaz commented Jan 12, 2021

Thanks for the very quick fix. This was a funny one, actually ;) Probably it is not to often that someone uses already given commands in this way. Would it be possible to bring a minor release with this fix? I am writing my thesis right now so I see the underline throuout the whole day ;)

@valentjn
Copy link
Owner

I did that in the beginning, too, even with the same command \O, so this is probably more common than you think.

Fix released in 8.2.1.

me-johnomar added a commit to me-johnomar/ltex-ls that referenced this issue Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1-bug 🐛 Issue type: Bug report (something isn't working as expected) 2-confirmed Issue status: Confirmed, reproducible bug in LTeX 3-fixed Issue resolution: Issue has been fixed on the develop branch
Projects
None yet
Development

No branches or pull requests

2 participants