Hi, How can I configure the tex_template to write Arabic In Manim?
- Ngôn ngữ chính
- Python
- Star
- 93.8k
- Fork
- 7.7k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
I want to display the text `"عشق"` in Manim.
This issue is pretty similar to #840
I have tried to do what was suggested for this issue (#840 that is) but I was unable to make it work.
1. Firstly, I changed TEX_USE_CTEX in manimlib/constants.py to True.
2. Then I changed the file ctex_template.tex as follows:
The original ctex_template.tex file was:
```tex
\documentclass[preview]{standalone}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{setspace}
\usepackage{tipa}
\usepackage{relsize}
\usepackage{textcomp}
\usepackage{mathrsfs}
\usepackage{calligra}
\usepackage{wasysym}
\usepackage{ragged2e}
\usepackage{physics}
\usepackage{xcolor}
\usepackage{microtype}
%\DisableLigatures{encoding = *, family = * }
\usepackage[UTF8]{ctex}
\linespread{1}
\begin{document}
YourTextHere
\end{document}
```
I have change it to:
```tex
\documentclass[preview]{standalone}
%\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{setspace}
\usepackage{tipa}
\usepackage{relsize}
\usepackage{textcomp}
\usepackage{mathrsfs}
\usepackage{calligra}
\usepackage{wasysym}
\usepackage{ragged2e}
\usepackage{physics}
\usepackage{xcolor}
\usepackage{microtype}
%\DisableLigatures{encoding = *, family = * }
\usepackage[UTF8]{ctex}
%\linespread{1}
\usepackage{polyglossia}
\setmainlanguage{arabic}
\setotherlanguage{english}
\newfontfamily\englishfont[Scale=MatchLowercase]{Linux Biolinum O}
\newfontfamily\arabicfont{Droid Arabic Naskh}
\begin{document}
YourTextHere
\end{document}
```
3. After this I tried rendering the following scene:
```python
class Test(Scene):
def construct(self):
text = TextMobject("عشق", font="Droid Arabic Naskh")
self.add(text)
```
I got the following error:
Traceback (most recent call last):
File "/Users/sameedmac/PycharmProjects/ManimPyCharmTrial/manim/manimlib/extract_scene.py", line 155, in main
scene = SceneClass(**scene_kwargs)
File "/Users/sameedmac/PycharmProjects/ManimPyCharmTrial/manim/manimlib/scene/scene.py", line 75, in __init__
self.construct()
File "/Users/sameedmac/Desktop/ManimTemplatePyCharm/main.py", line 15, in construct
text = TextMobject("عشق", font="Droid Arabic Naskh")
File "/Users/sameedmac/PycharmProjects/ManimPyCharmTrial/manim/manimlib/mobject/svg/tex_mobject.py", line 147, in __init__
SingleStringTexMobject.__init__(
File "/Users/sameedmac/PycharmProjects/ManimPyCharmTrial/manim/manimlib/mobject/svg/tex_mobject.py", line 42, in __init__
file_name = tex_to_svg_file(
File "/Users/sameedmac/PycharmProjects/ManimPyCharmTrial/manim/manimlib/utils/tex_file_writing.py", line 21, in tex_to_svg_file
dvi_file = tex_to_dvi(tex_file)
File "/Users/sameedmac/PycharmProjects/ManimPyCharmTrial/manim/manimlib/utils/tex_file_writing.py", line 69, in tex_to_dvi
raise Exception(
Exception: Latex error converting to dvi. See log output above or the log file: media/Tex/1fdc1280131ec656.log
Process finished with exit code 0
I am not sure what I am supposed to do now. Any help with this issue would be great.
Thank you:)
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
The issue involves configuring tex_template for Arabic text in Manim. Start by examining manimlib/constants.py for TEX_USE_CTEX and the ctex_template.tex file. Review the error log from media/Tex/1fdc1280131ec656.log to understand the LaTeX failure. Look at how TextMobject processes fonts and the tex_to_svg_file function in manimlib/utils/tex_file_writing.py. Done looks like successfully rendering Arabic text without LaTeX errors.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- latex, python
- Lĩnh vực
- internationalization
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100