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

Writing Bengali in Manim #735

Closed
hridoy100 opened this issue Sep 25, 2019 · 16 comments
Closed

Writing Bengali in Manim #735

hridoy100 opened this issue Sep 25, 2019 · 16 comments

Comments

@hridoy100
Copy link

hridoy100 commented Sep 25, 2019

I want to write Bangla through Manim. But after writing the text and compiling it causes errors.

I've attempted to solve the problem on my own but failed.
The command that I've run was: python -m manim example_scenes.py WriteStuff -pl.
In the example_scenes.py file, i've changed the text of WriteStuff class. I've changed it to


example_text = TextMobject(
"বাংলা",
tex_to_color_map={"text": YELLOW}
)


Then it shows the following errors:

Writing "\centering বাংলা" to ./media\Tex\f846dd8efc3d12cf.tex Traceback (most recent call last):

File "C:\manim\manimlib\extract_scene.py", line 155, in main scene = SceneClass(**scene_kwargs)

File "C:\manim\manimlib\scene\scene.py", line 53, in init self.construct()

File "example_scenes.py", line 102, in construct tex_to_color_map={"text": YELLOW}

File "C:\manim\manimlib\mobject\svg\tex_mobject.py", line 144, in init self, self.arg_separator.join(tex_strings), **kwargs

File "C:\manim\manimlib\mobject\svg\tex_mobject.py", line 44, in init self.template_tex_file_body

File "C:\manim\manimlib\utils\tex_file_writing.py", line 19, in tex_to_svg_file dvi_file = tex_to_dvi(tex_file)

File "C:\manim\manimlib\utils\tex_file_writing.py", line 67, in tex_to_dvi "See log output above or the log file: %s" % log_file)

Exception: Latex error converting to dvi. See log output above or the log file: ./media\Tex\f846dd8efc3d12cf.log


I've tried adding following packages to tex_template.tex file :
\usepackage[banglamainfont=Kalpurush, banglattfont=Siyam Rupali]{latexbangla}

@zavdn
Copy link

zavdn commented Sep 25, 2019

See this, or this, or this.

@zavdn
Copy link

zavdn commented Sep 25, 2019

You need to use latexbangla or xelatex, you can modify that configuration here:

@hridoy100
Copy link
Author

hridoy100 commented Sep 25, 2019

Used xelatex as u mentioned. And added
\usepackage[banglamainfont=Akaash,banglattfont=Akaash]{latexbangla} in the

tex_template.tex

file.


But still showing the same error. This time it's also showing
Sorry, but maketfm did not succeed.
The log file hopefully contains the information to get MiKTeX going again:


googled it and tried running
updmap.exe --admin in the directory :
C:\Program Files\MiKTeX 2.9\miktex\bin\x64>updmap.exe --admin
but it didn't work.

@zavdn
Copy link

zavdn commented Sep 26, 2019

To enable xelatex you have to modify this to True, and add that packages to manimlib\ctex_template.tex.

@hridoy100
Copy link
Author

Did all of these things. But still showing errors. It's not even executing any English words.

@hridoy100
Copy link
Author

Just changed this as True. Then executed the program without changing any other thing. Now it's showing error even in the case of English words.

@zavdn
Copy link

zavdn commented Sep 27, 2019

You have to install xelatex and LaTeXBangla, and you have to added to the PATH variable.

@hridoy100
Copy link
Author

I would be grateful if you tell me about the installation process :)

@hridoy100
Copy link
Author

installed xelatex. But still problem occurs

@xy-23
Copy link
Contributor

xy-23 commented Sep 30, 2019

You can try Text instead of TextMobject
You can see #680 for more information

@hridoy100
Copy link
Author

You can try Text instead of TextMobject
You can see #680 for more information

Thank you. It worked. I've written

script = '''Hello কি করিছস'''
class FirstScene(Scene):
def construct(self):
	text=Text(script, font='Kalpurush')
	self.play(Write(text))

but the image shows this:
FirstScene

*I've also tried using other font families.

@xy-23
Copy link
Contributor

xy-23 commented Oct 4, 2019

The rendering bug is caused by the package called pycairo that I used to generate svg files.
I have feedbacked this problem to pycairo and wait for the solution.
I am not sure when the bug can be fixed, so I recommend to try to use TextMobject again or use other software like Adobe Illustrator to generate svgs which has those texts and use SVGMobject to generate it into videos.

@hridoy100
Copy link
Author

The rendering bug is caused by the package called pycairo that I used to generate svg files.
I have feedbacked this problem to pycairo and wait for the solution.
I am not sure when the bug can be fixed, so I recommend to try to use TextMobject again or use other software like Adobe Illustrator to generate svgs which has those texts and use SVGMobject to generate it into videos.

Thank you very much 👍

@aburousan
Copy link

hridya100 so after installing xelatex you just used Text and it worked?

@rafisics
Copy link

Hi, how is it finally solved? I want to write Bangla in manim using latexbangla package.

@rafisics
Copy link

If anyone is looking for a way to display Bangla texts/sentences containing inline-maths in manim, check here or here.
Let me know if you know any better way else.

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

No branches or pull requests

5 participants