You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A way with -- hopefully -- only moderate intrusion could be as follows.
YaLafi core
Macros for language change as \selectlanguage leave special tokens that indicate the switch of language in the expanded token list.
The parser switches language-dependent settings as maths replacements, when it sees such a special token.
Currently, the function utils.get_txt_pos() transforms the expanded token list into a string and a character position map at the very end. This is changed. It then produces separate strings and position maps for each detected language, using the special tokens from above.
Altogether, this should even allow nested language changes and changes, e.g., inside of \text in equations.
Yalafi.shell
It sends multiple requests to LanguageTool.
As currently, messages are sorted according to their occurrence in the LaTeX text.
We should implement some heuristic that decides whether a language change by \foreignlanguage really breaks the text flow of the surrounding language, or whether it is rather short. In the latter case, it should be substituted by a placeholder in the text flow of the surrounding language (as is done with inline formulas), continuing its sentence / paragraph.
There will remain at least one bug. The scanner currently is initialised with a language code that, for instance on 'de', detects "' as a special token in German texts. Since the scanner first scans the whole LaTeX text, this won't be changed inside of \foreignlanguage{english}{"'}.
The text was updated successfully, but these errors were encountered:
A way with -- hopefully -- only moderate intrusion could be as follows.
YaLafi core
Yalafi.shell
We should implement some heuristic that decides whether a language change by \foreignlanguage really breaks the text flow of the surrounding language, or whether it is rather short. In the latter case, it should be substituted by a placeholder in the text flow of the surrounding language (as is done with inline formulas), continuing its sentence / paragraph.
There will remain at least one bug. The scanner currently is initialised with a language code that, for instance on 'de', detects
"'
as a special token in German texts. Since the scanner first scans the whole LaTeX text, this won't be changed inside of\foreignlanguage{english}{"'}
.The text was updated successfully, but these errors were encountered: