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

repeated whitespace warning around mintinline when writing in Dutch. #3621

Open
VVelthuizenHanze opened this issue Aug 4, 2024 · 4 comments
Labels
bug Deficiencies in TeXiFy behaviour. Grazie

Comments

@VVelthuizenHanze
Copy link

When writing in Dutch I get a repeated whitespace warning around mintinline command, suggesting the LanguageTool doesn't realize the body of mintinline will be part of the text.

I don't have this problem in English, is there a setting I can change to fix this? I don't want to disable proofreading all together.

MWE:

\documentclass[11pt]{article}

\usepackage[newfloat]{minted}

\begin{document}

Een uitleg van het \mintinline{java}{abstract} keyword in java.

\end{document}

The MWE shown in IntelliJ with the repeated whitespace error

@VVelthuizenHanze VVelthuizenHanze added the untriaged Issue type still needs to be triaged or verified. label Aug 4, 2024
@PHPirates
Copy link
Collaborator

PHPirates commented Aug 12, 2024

Thanks for reporting this! The problem is also in English, see #3141, #3494 and #3508. Essentially, the problem is that somehow we need to tell Grazie that the rendered sentence reads "... van het abstract keyword in java..." and not "... van het java abstract keyword in java..." or "... van het keyword in java..." because that may lead to more false positive warnings in general (though probably not in this case).
I do not yet know of a generic (approximate) way to tell if a word in a command will end up being typeset or not, as in the end we can only know this by typesetting the full document of course.

@PHPirates PHPirates added bug Deficiencies in TeXiFy behaviour. Grazie and removed untriaged Issue type still needs to be triaged or verified. labels Aug 12, 2024
@VVelthuizenHanze
Copy link
Author

It sounds to me like there needs to be a settings page for TeXiFy where commands can be added and specified how they work and that is pre-filled with common commands. (quickly reading through the mentioned issues I'm thinking at least check marks for: "produces output" and one for "produces surrounding white space".

Is this something I could help build? Or am I overstepping in even suggesting this (maybe you already have other ideas)?

@PHPirates
Copy link
Collaborator

Maybe. It makes sense for super special commands where you would only need to specify a few commands in settings, and this was suggested in #3492 (comment) as well. However, for this we need information about all LaTeX commands, which is a bit too much.

If you want to help, that would be great! I think the first step is to solve this particular issue, that may be relatively easy and has to be done anyway.
In the LatexTextExtractor class what we do is provide text ranges to ignore, so in the current implementation I guess we ignore just all commands. However, in your example, that means \mintinline{java}{abstract} is removed and we send Een uitleg van het keyword in java. Note the double space.

Instead, we could remove one of the spaces and send Een uitleg van het keyword in java. which happens to be grammatically correct.
We could also just assume for now the first argument is the text, so we would send Een uitleg van het java keyword in java. which is grammatically correct. But then we still need to ignore commands like \usepackage, \begin, etc. Maybe we should just ignore all commands not in the middle of a sentence?

(text ranges are retrieved from the psi structure, which notably does not include spaces, but there are tricks to get around that)

@VVelthuizenHanze
Copy link
Author

I look forward to diving into this. I have a deadline and a short vacation first. Thank you for pointing me in the right direction!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Deficiencies in TeXiFy behaviour. Grazie
Projects
None yet
Development

No branches or pull requests

2 participants