https://discord.com/channels/581738731934056449/1021149218523586560/1022599268051202078
Last active
March 19, 2023 13:08
-
-
Save uwezi/2803196466ff64135c5f0becc2159b8e to your computer and use it in GitHub Desktop.
[STIX2 LaTeX font in Manim] How to use the stix2-fontpackage in Manim's LaTeX. #manim #latex #xetex #stix2 #font
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://discord.com/channels/581738731934056449/1021149218523586560/1022599268051202078 | |
| from manim import * | |
| myTexTemp2 = TexTemplate( | |
| tex_compiler="xelatex", | |
| output_format='.pdf', | |
| ) | |
| myTexTemp2.add_to_preamble(r"\usepackage{siunitx}") | |
| myTexTemp4 = TexTemplate( | |
| tex_compiler="xelatex", | |
| output_format='.pdf', | |
| ) | |
| myTexTemp4.add_to_preamble(r"\usepackage{siunitx}\usepackage{stix2}") | |
| class Latexy(Scene): | |
| def construct(self): | |
| MathTex.set_default(font_size=28) | |
| Tex.set_default(font_size=28) | |
| str = r"g_m = \frac{{\partial I_{{C}}}}{{\partial U_{{BE}}}}=\qty{{ {:.1f} }}{{mS}}".format(400) | |
| t2 = MathTex(str, tex_template=myTexTemp2).shift(2*UP) | |
| h2 = Tex("XeLaTeX pdf").next_to(t2, LEFT) | |
| t3 = MathTex(str, tex_template=myTexTemp4).next_to(t2, DOWN) | |
| h3 = Tex("XeLaTeX PDF STIX2").next_to(t3, LEFT) | |
| t4 = MathTex(str, tex_template=myTexTemp4, stroke_width=0.3).next_to(t3, DOWN) | |
| h4 = Tex("XeLaTeX pdf STIX2 stroke 0.3").next_to(t4, LEFT) | |
| self.play(Write(h2),Write(h3),Write(h4)) | |
| self.play(Write(t2),Write(t3),Write(t4)) | |
| self.wait(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
