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

Support multi-language documents #98

Closed
matze-dd opened this issue Oct 30, 2020 · 0 comments
Closed

Support multi-language documents #98

matze-dd opened this issue Oct 30, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@matze-dd
Copy link
Collaborator

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}{"'}.

@matze-dd matze-dd added the enhancement New feature or request label Oct 30, 2020
matze-dd added a commit that referenced this issue Nov 6, 2020
matze-dd added a commit that referenced this issue Nov 6, 2020
matze-dd added a commit that referenced this issue Nov 6, 2020
matze-dd added a commit that referenced this issue Nov 6, 2020
matze-dd added a commit that referenced this issue Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant