Closed GrouperTamaki closed 5 years ago
Try modify the manimlib/tex_template.tex file with some of this packages
Paste this in your manimlib/tex_template.tex file:
\documentclass[preview]{standalone}
\usepackage[english]{babel}
\usepackage{CJKutf8} % This is the package for Japanese language
\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{textcomp}
\usepackage{microtype}
\DisableLigatures{encoding = *, family = * }
%\usepackage[UTF8]{ctex}
\linespread{1}
\newcommand{\jap}[1]{\begin{CJK}{UTF8}{min}#1\end{CJK}} % This is a new command created to write the text
\begin{document}
YourTextHere
\end{document}
This is a scene:
class Japan(Scene):
def construct(self):
tex=TextMobject("\\jap{これはmanimのあるアニメーションです}").scale(1.5)
self.play(Write(tex))
self.wait()
And this is the result:
Thanks a lot ! You are a kind man !
Your welcome, please close the issue.
Sorry, I have one more question.
In Japan, we use upLaTeX rather than pdfLaTeX which is widely used in English community. upLaTeX is a Japanese-optimized version of LaTeX engines and is the first choice for Japanese people when we use LaTeX.
So, if it's possible to change LaTeX engine used in manim (This is pdfLaTeX) to upLaTeX, I want to know how to do it and how to use it.
If no solution is available, ignore this question.
Thank you.
In the line 44 of manimlib/utils/tex_file_writing.py you can change the compiler by default. I don't know the differences between upLaTeX and pdfLaTeX, but you can try.
Thank you !
I'll try it.
In the line 44 of manimlib/utils/tex_file_writing.py you can change the compiler by default. I don't know the differences between upLaTeX and pdfLaTeX, but you can try.
Hi I get the same issue but with Chinese.
I use this Chinese font here
It works fine on Windows, but when I turn to Linux(Ubuntu and Manjaro both tried same error) the Chinese char become square.
Here is the code pretty simple
def intro_part(self):
# Main title intro
t1 = Text("从夹角到六角星", font="上首水滴体", color=BLUE_B)
self.play(Write(t1))
The font is installed successfully on Linux. I can see it in the editor "kate" config panel
I checked your answers and some other post and make the tex_template like this:
\documentclass[preview]{standalone}
\usepackage[english]{babel}
\usepackage{CJKutf8} % This is the package for Japanese language
\usepackage{xeCJK}
\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{textcomp}
\usepackage{microtype}
\DisableLigatures{encoding = *, family = * }
%\usepackage[UTF8]{ctex}
\linespread{1}
%\newcommand{\jap}[1]{\begin{CJK}{UTF8}{min}#1\end{CJK}} % This is a new command created to write the text
\begin{document}{CJK*}{UTF8}{gbsn}
YourTextHere
\end{document}
But this template dont work for me. Since I dont know much about latex config can you give me a hint?
The problem was fixed differently on my end. My solution:
Support for Chinese and Japanese follow manim guide on Github
sudo apt install texlive-full
ctex_template.tex
to the following
\documentclass[preview]{standalone}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc} % added for both Japanese and Chinese Supports
\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}
4. edit configuration in file `constants.py`
`TEX_USE_CTEX = True # Support Chinese`
Paste this in your manimlib/tex_template.tex file:
\documentclass[preview]{standalone} \usepackage[english]{babel} \usepackage{CJKutf8} % This is the package for Japanese language \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{textcomp} \usepackage{microtype} \DisableLigatures{encoding = *, family = * } %\usepackage[UTF8]{ctex} \linespread{1} \newcommand{\jap}[1]{\begin{CJK}{UTF8}{min}#1\end{CJK}} % This is a new command created to write the text \begin{document} YourTextHere \end{document}
This is a scene:
class Japan(Scene): def construct(self): tex=TextMobject("\\jap{これはmanimのあるアニメーションです}").scale(1.5) self.play(Write(tex)) self.wait()
I'm sorry but how do I edit the file? Where is it?
Paste this in your manimlib/tex_template.tex file:
\documentclass[preview]{standalone} \usepackage[english]{babel} \usepackage{CJKutf8} % This is the package for Japanese language \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{textcomp} \usepackage{microtype} \DisableLigatures{encoding = *, family = * } %\usepackage[UTF8]{ctex} \linespread{1} \newcommand{\jap}[1]{\begin{CJK}{UTF8}{min}#1\end{CJK}} % This is a new command created to write the text \begin{document} YourTextHere \end{document}
This is a scene:
class Japan(Scene): def construct(self): tex=TextMobject("\\jap{これはmanimのあるアニメーションです}").scale(1.5) self.play(Write(tex)) self.wait()
And this is the result:
[ ![Japan](https://user-images.githubusercontent.com/43224662/57177966-57f98780-6e2f-11e9-8c2a-c5f7b3228387.gif) ](https://user-images.githubusercontent.com/43224662/57177966-57f98780-6e2f-11e9-8c2a-c5f7b3228387.gif) [ ](https://user-images.githubusercontent.com/43224662/57177966-57f98780-6e2f-11e9-8c2a-c5f7b3228387.gif) [ ](https://user-images.githubusercontent.com/43224662/57177966-57f98780-6e2f-11e9-8c2a-c5f7b3228387.gif) ![Japan](https://user-images.githubusercontent.com/43224662/57177966-57f98780-6e2f-11e9-8c2a-c5f7b3228387.gif) [ ![Japan](https://user-images.githubusercontent.com/43224662/57177966-57f98780-6e2f-11e9-8c2a-c5f7b3228387.gif) ](https://user-images.githubusercontent.com/43224662/57177966-57f98780-6e2f-11e9-8c2a-c5f7b3228387.gif) [ ](https://user-images.githubusercontent.com/43224662/57177966-57f98780-6e2f-11e9-8c2a-c5f7b3228387.gif) [ ](https://user-images.githubusercontent.com/43224662/57177966-57f98780-6e2f-11e9-8c2a-c5f7b3228387.gif)
I'm sorry but how do I edit the file? Where is it?
Same. Don't know how to get it.
Hello, I'm a Japanese and I want to use Japanese fonts in manim. So, I made and tried a Japanese-font-testing-program called "JapaneseTextTest.py" as follows:
But I have a trouble in running this.
The log file is as follows:
Would someone tell me how to solve this problem ?