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

Line break with Russian Language #192

Open
Aqoolare opened this issue May 4, 2021 · 22 comments
Open

Line break with Russian Language #192

Aqoolare opened this issue May 4, 2021 · 22 comments
Labels
Status/1. Ready This issue has been confirmed and is ready to be worked on. Type/Bug

Comments

@Aqoolare
Copy link

Aqoolare commented May 4, 2021

Describe the bug

Line break does not work when using the Russian language.

To Reproduce

Steps to reproduce the behavior:

  1. Add a string "Число d > 0 называется наибольшим общим делителем (НОД) двух целых чисел a и b, если оно удовлетворяет следующим условиям: 1) d | a и d | b; 2) если c | a и c | b, то c | d." to the LaTeX field of the TextView.

Expected behavior

Words are wrapped to a new line at the end of a word

Environment (please complete the following information):

  • Platform: [CSharpMath.Forms]
  • Package Version or Commit: [0.5.0]
  • Device: [Pixel 2 Q 10.0]

1

Additional context

I really need to solve this problem :(

@Aqoolare Aqoolare added Status/0. New This issue is new and is awaiting confirmation from the maintainers. Type/Bug labels May 4, 2021
Happypig375 added a commit that referenced this issue May 4, 2021
@Happypig375 Happypig375 added Status/1. Ready This issue has been confirmed and is ready to be worked on. and removed Status/0. New This issue is new and is awaiting confirmation from the maintainers. labels May 4, 2021
@Aqoolare
Copy link
Author

Aqoolare commented May 4, 2021

Thank you very much for your prompt answer, but I am having problems using the given solution.
But I have some problems with its application, I attach screenshots with errors. And also I have a question, where should this code be placed in the project?
3
1
2

@Happypig375
Copy link
Collaborator

@Aqoolare The change is not published yet, I'll publish a 0.5.1 and you can use that code.

Also to use C# 9 which I've used, you must add <LangVersion>latest</LangVersion> to the <PropertyGroup> inside your .csproj.

@Aqoolare

This comment has been minimized.

@Happypig375

This comment has been minimized.

@Aqoolare

This comment has been minimized.

@Happypig375
Copy link
Collaborator

You can also add your own line breaks with \\ or reduce the font size.

@Aqoolare
Copy link
Author

Aqoolare commented May 4, 2021

Ok, thank you very much for such prompt support.

@charlesroddie

This comment has been minimized.

@Aqoolare

This comment has been minimized.

@Aqoolare

This comment has been minimized.

@Aqoolare

This comment has been minimized.

@Happypig375

This comment has been minimized.

Happypig375 added a commit that referenced this issue May 5, 2021
@Aqoolare

This comment has been minimized.

@Aqoolare

This comment has been minimized.

@Happypig375

This comment has been minimized.

@Aqoolare

This comment has been minimized.

@Aqoolare

This comment has been minimized.

@Aqoolare

This comment has been minimized.

@Happypig375

This comment has been minimized.

@Aqoolare
Copy link
Author

Aqoolare commented May 7, 2021

Guys, I found how to solve the display problem! I used the wrapper this way public class MyTextView : TextView { public MyTextView() { InvalidateSurface(); } }
And used it on xaml this way <views:MyTextView x:Name="textView" LaTeX="{Binding Formula}" Margin="15, 5" FontSize="43"/>
But issue with the words wrapping remains

image

Maybe I don't understand where to put this code CSharpMath.Rendering.Text.TextLaTeXParser.AdditionalBreakingEngines.Add(new RussianBreakingEngine());

@charlesroddie
Copy link
Collaborator

charlesroddie commented May 7, 2021

This thread is getting overloaded with different issues so I've hidden everything not related to line breaks. Please post other issues if you have unresolved questions not relating to line breaks @Aqoolare . Thanks.

Currently CSharpMath uses Typography.TextBreak, so one option is to wait for Typography.TextBreak to resolve the issue that @Happypig375 posted.

I'm not convinced that text breaking is difficult enough to require a separate engine. Can't we break on spaces and hyphens only? LaTeX doesn't usually support automatic hyphenation and I assume we have no plan to support that, so breaking should be easy shouldn't it?

Overleaf breaks on spaces and commas but not punctuation:

image
image

@Aqoolare
Copy link
Author

Aqoolare commented May 7, 2021

This thread is getting overloaded with different issues so I've hidden everything not related to line breaks. Please post other issues if you have unresolved questions not relating to line breaks @Aqoolare . Thanks.

Currently CSharpMath uses Typography.TextBreak, so one option is to wait for Typography.TextBreak to resolve the issue that @Happypig375 posted.

I'm not convinced that text breaking is difficult enough to require a separate engine. Can't we break on spaces only? LaTeX doesn't usually support hyphenation and I assume we have no plan to support that, so breaking should be easy shouldn't it?

My other problems have been resolved, thanks, the only thing I would like to clarify, that is, at the moment the transfer by Russian words does not work?

Even with this code 'CSharpMath.Rendering.Text.TextLaTeXParser.AdditionalBreakingEngines.Add(new RussianBreakingEngine());'?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status/1. Ready This issue has been confirmed and is ready to be worked on. Type/Bug
Projects
None yet
Development

No branches or pull requests

3 participants