Manim Chinese display problem error solution

If you use Manim to directly create this kind of animated video, it does not support Chinese and requires some modifications. The effect is as shown in the figure.
Insert image description here
However, the modified plans were too confusing. After continuous research, I found a relatively simple and practical method.

Source file modification

Use everuthing to find ctex_template.texthe file.

The path I have here D:\MyTools\anaconda3\Lib\site-packages\manimlib\tex_templatesmust be tex_templatesunder.

Insert image description here
Open tex_templatesthe file and add the following code.

\usepackage{xeCJK}
\setCJKmainfont{Microsoft JhengHei}

\usepackage{xeCJK}
\setCJKmainfont{SimHei}

The result is as shown in the figure. setCJKmainfontThe font files that can be used are set in it. This needs to be found in your system, then save and close.

Guess you like

Origin blog.csdn.net/qq_20288327/article/details/132846813