manim: Write Chinese words problem!
Hi,I am Chinese, so I need to use it to write some Chinese words, I have tried to use template.tex as README.TXT said, and I alse tried to add below codes at the beginning,It still not work in ./example_scenes.py WriteStuff
#!/usr/bin/python
# -*- coding: UTF-8 -*-
here is error message,someone please help
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 20 (4 by maintainers)
Try to set the font that your computer has that support Chinese characters. This way works.
中国,如果下载的是最新版本的manim,并且只是想要在manim中显示中文, 对于LaTeX没有中文显示需求的, 可以直接按照如下操作进行.
直接修改
manimlib/constants.py
第50行的TEX_USE_CTEX = False
为TEX_USE_CTEX = True
now, we can modify directly in manimlib/constants.py , change line 50,
TEX_USE_CTEX = False
toTEX_USE_CTEX = True
windows 路径问题
LaTex 中文问题 修改constants.py line 50 TEX_USE_CTEX = True 对应逻辑: 1.使用CTEX模板文件 (默认为TEX模板文件) 2.使用XDV文件生成视频图片 (默认使用DVI)
Edit (October 15, 2019):
As per #315, now we only have to change the line
to
in the file
manimlib/constants.py
.See below.
Original Comment
@pu17 Try changing manim/mobject/svg/svg_mobject.py, lines 50-63:
to
2020 修改 / Edit:
据#315,只要在
manimlib/constants.py
改下面一行: / As per #315, now you only have to change the line in the filemanimlib/constants.py
:改成 / to
就好了。
见 下面评论。 / See comment below.
这一行把 LaTeX 命令改成 XeLaTeX 来生成 xdv 而不是 dvi 文件,然后用它来生成 svg,并使用
ctex_template.tex
代替tex_template.tex
。 / This line replaces the LaTeX command with XeLaTeX, and outputs xdv instead of dvi to generate the svg file. It also uses thectex_template.tex
template instead oftex_template.tex
.原始评论 / Original comment
You can write Chinese with the following changes:
In
tex_template.tex
, change lines 19-20:to:
Then, in
utils/tex_file_writing.py
, change lines 46-88:to:
Reference: PR #48 Issue #64
@DGideas It was like that a few years ago (see #48, the PR by @Solara570 back in 2017), but CTEX uses XeLaTeX which causes a lot of other problems like #64 or #124 or #142 (these were really old issues). Eventually it was deleted in #200.