Reconsidering TEX_USE_CTEX / using XeLaTeX
See original GitHub issueI worked on manim back in 2018. I added the function for using CTeX (XeLaTeX package for Chinese) and XeLaTeX instead of LaTeX using the flag TEX_USE_CTEX
in constants.py (#315).
I have stopped working on manim since 2019, but over the months there are apparently more and more people who want to use LaTeX rendering in non-English languages, and even on very old issues I still occasionally see people asking how to do that… Looking back at my change I really should have decoupled using CTeX (TeX template) from XeLaTeX (rendering tool). This has caused a lot of confusions and made weird hacks/fixes necessary for only using XeLaTeX, especially for a language that is not Chinese or English, with the most recent #858 and #840. It really should have been a flag TEX_USE_XELATEX
and another flag TEMPLATE_TEX_NAME
, and the flag TEX_USE_CTEX
is such that when it is True
, TEX_USE_XELATEX
is True
and TEMPLATE_TEX_NAME
is "ctex_template.tex"
; otherwise TEX_USE_XELATEX
is False
and TEMPLATE_TEX_NAME
is "tex_template.tex"
. Then set TEMPLATE_TEX_FILE
to os.path.join(os.path.dirname(os.path.realpath(__file__)), TEMPLATE_TEX_NAME)
. Corresponding logic: constants.py lines 74–79.
It might be even better to set it dynamically using a function or as a parameter of TexMobject()
, (see issues like #891). I looked at the source code and this is definitely possible. The options I can think of are
- Use the current
TEX_USE_CTEX
- Add flags
TEX_USE_XELATEX
andTEMPLATE_TEX_NAME
, and reworkTEX_USE_CTEX
- Add parameters for
TexMobject()
likeuse_xelatex=False
andtex_template="tex_template.tex"
- Use the flags of 2. as a default, and make it possible to change the default using 3.
Not really sure if this is the right place to raise this issue.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top GitHub Comments
#723 is also a pretty good idea and there is a similar pr #745 although it doesn’t decouple CTeX from XeLaTeX
Closing as issue is fixed downstream at ManimCommunity. Anyone interested in multilingual support is recommended to use the community version.