3b1b / manim

Animation engine for explanatory math videos
MIT License
71.22k stars 6.25k forks source link

Updating MikTex breaks Manim latex conversion (with workaround) #1285

Open karelo911 opened 3 years ago

karelo911 commented 3 years ago

If this is a support request:

Please attempt to solve the problem on your own before opening an issue. Between old issues, StackOverflow, and Google, you should be able to find solutions to most of the common problems.

Include at least:

  1. Steps to reproduce the issue (e.g. the command you ran)
  2. The unexpected behavior that occurred (e.g. error messages or screenshots)
  3. The environment (e.g. operating system and version of manim)

If this is a feature request:

Include the motivation for making this change.

Something is wrong with either MikTex or Manim itself, but Manim doesn't render TextMobjects properly after updating MikTex packages to the latest version. I've read a similar issue posted here https://github.com/3b1b/manim/issues/1239 showing that "g0-65 is not supported" and some letters are not rendered.

I managed to resolve this temporarily by reinstalling MikTex Basic, deferring updates, and letting MikTex only install necessarily packages when rendering animations. I hope MikTex gets this fixed asap or maybe there is a necessary fix on Manim's end. I'm quite new to Manim so I don't know much about how MikTex renders LaTex input. I just want to share how I worked around this issue for those who experienced the same lately. Thanks.

Maxicl14 commented 3 years ago

Yes, I've had the same problem too. Providing some warnings I've had here in case they help:

Writing "\centering This is some \LaTeX" to C:\Manim\manim_2020\media\Tex\664e80e8d8d98482.tex C:\Manim\manim_2020\manimlib\mobject\svg\svg_mobject.py:125: UserWarning: g1-84 not recognized warnings.warn("%s not recognized" % ref) C:\Manim\manim_2020\manimlib\mobject\svg\svg_mobject.py:125: UserWarning: g1-104 not recognized warnings.warn("%s not recognized" % ref) C:\Manim\manim_2020\manimlib\mobject\svg\svg_mobject.py:125: UserWarning: g1-105 not recognized warnings.warn("%s not recognized" % ref) C:\Manim\manim_2020\manimlib\mobject\svg\svg_mobject.py:125: UserWarning: g1-115 not recognized warnings.warn("%s not recognized" % ref) C:\Manim\manim_2020\manimlib\mobject\svg\svg_mobject.py:125: UserWarning: g1-111 not recognized warnings.warn("%s not recognized" % ref) C:\Manim\manim_2020\manimlib\mobject\svg\svg_mobject.py:125: UserWarning: g1-109 not recognized warnings.warn("%s not recognized" % ref) C:\Manim\manim_2020\manimlib\mobject\svg\svg_mobject.py:125: UserWarning: g1-101 not recognized warnings.warn("%s not recognized" % ref) C:\Manim\manim_2020\manimlib\mobject\svg\svg_mobject.py:125: UserWarning: g1-76 not recognized warnings.warn("%s not recognized" % ref) C:\Manim\manim_2020\manimlib\mobject\svg\svg_mobject.py:125: UserWarning: g0-65 not recognized warnings.warn("%s not recognized" % ref) C:\Manim\manim_2020\manimlib\mobject\svg\svg_mobject.py:125: UserWarning: g1-69 not recognized warnings.warn("%s not recognized" % ref) C:\Manim\manim_2020\manimlib\mobject\svg\svg_mobject.py:125: UserWarning: g1-88 not recognized warnings.warn("%s not recognized" % ref)

karelo911 commented 3 years ago

In addition, I also observed that the string "gx-xxx" pertains to a specific character that was not rendered in the animation. For instance, g0-65 I think results in capital letter "A" not rendering, g0-67 results to "C" not rendering and so on.

vasiljevic commented 3 years ago

In new versions of MikTeX, Metafont has trouble with building the European Computer Modern fonts.

My workaround is to switch to XeLaTeX and Unicode. You need to set TEX_USE_CTEX = True in https://github.com/3b1b/manim/blob/master/manimlib/constants.py#L74

If you don't need to use Chinese fonts you may also comment out second line in https://github.com/3b1b/manim/blob/master/manimlib/ctex_template.tex#L2

rafaelcharris commented 3 years ago

I found a way around as well. I had to erase fontenc from the tex_template.tex file. Not my solution, it was thanks to this post here: https://github.com/3b1b/manim/issues/1276#issuecomment-742292726

karelo911 commented 3 years ago

In new versions of MikTeX, Metafont has trouble with building the European Computer Modern fonts.

My workaround is to switch to XeLaTeX and Unicode. You need to set TEX_USE_CTEX = True in https://github.com/3b1b/manim/blob/master/manimlib/constants.py#L74

If you don't need to use Chinese fonts you may also comment out second line in https://github.com/3b1b/manim/blob/master/manimlib/ctex_template.tex#L2

I found a way around as well. I had to erase fontenc from the tex_template.tex file. Not my solution, it was thanks to this post here: #1276 (comment)

Thank you for these suggestions. For those who experience the same issues with Manim rendering LaTeX you may try our workarounds in this thread. I hope this gets patched with the next update, either through MikTeX or Manim itself.

joakimjalden commented 3 years ago

In new versions of MikTeX, Metafont has trouble with building the European Computer Modern fonts. My workaround is to switch to XeLaTeX and Unicode. You need to set TEX_USE_CTEX = True in https://github.com/3b1b/manim/blob/master/manimlib/constants.py#L74 If you don't need to use Chinese fonts you may also comment out second line in https://github.com/3b1b/manim/blob/master/manimlib/ctex_template.tex#L2

I found a way around as well. I had to erase fontenc from the tex_template.tex file. Not my solution, it was thanks to this post here: #1276 (comment)

Thank you for these suggestions. For those who experience the same issues with Manim rendering LaTeX you may try our workarounds in this thread. I hope this gets patched with the next update, either through MikTeX or Manim itself.

I was able to solve it on my Windows 10 installation with MiKTeX by simply installing the cm-super package (see #1276 and also #1239 where this was suggested by @codingwithmagga). The cm-super package includes the needed Type 1 European Computer Modern fonts.