Open Luis-Henrique655 opened 4 years ago
Hello,
It is possible to install a LaTeX package and use them if you install manim from its source at https://github.com/3b1b/manim. After dumping your source to your computer, you can go to /path/to/manim
and then open the file manimlib/ctex_template.tex
. After opening the file, you can add \usepackage{...}
to import the packages.
Also, do not forget to re-install this modified version
From: Luis-Henrique655 notifications@github.com Sent: Wednesday, September 11, 2019 9:17 To: malhotra5/Manim-Tutorial Cc: Subscribed Subject: [malhotra5/Manim-Tutorial] Chemistry figures in manim (#10)
I was trying to make molecules ,with manim, arraying polygons, lines and letters and it turn out to be a huge pain. Does someone know if it's possible to install a LaTex package (Chemfig) and use LaTex (the same way we use to generate equations) but to generate LaTex figures in manim ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/malhotra5/Manim-Tutorial/issues/10?email_source=notifications&email_token=AF5X74IEUKBJ7HYYOONEXFTQJBBLHA5CNFSM4IVOD2SKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HKS26SA, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AF5X74KXPEXZK2A5HL3QQ6TQJBBLHANCNFSM4IVOD2SA.
The problem with this is that the bonding between atoms cannot be shown properly:
Well, there is a mistake to be corrected, also add the lines to tex_template.tex
as well. You can reinstall using the following command:
cd /path/to/manim
python3 setup.py install
At last you need to use TextMobject instead of TexMobject since the latter one is only for math formula rendering. Inside the TexMobject you only need to specify "\chemfig{...}"
Travor Liu travor_lzh@outlook.com
On Sep 11, 2019, at 17:18, Luis-Henrique655 notifications@github.com wrote:
Hi, thank you very much for answering. I downloaded the package and added in ctex_template. Could you help me a little more? How to re-install this modified version ? And how to use the package inside the python code? Do I have to specify the package inside the TexMobject command ?
On Wed, Sep 11, 2019, 10:32 AM Travor Liu notifications@github.com wrote:
Hello, It is possible to install a LaTeX package and use them if you install manim from its source at https://github.com/3b1b/manim. After dumping your source to your computer, you can go to
/path/to/manim
and then open the filemanimlib/ctex_template.tex
. After opening the file, you can add\usepackage{...}
to import the packages.
From: Luis-Henrique655 notifications@github.com Sent: Wednesday, September 11, 2019 9:17 To: malhotra5/Manim-Tutorial Cc: Subscribed Subject: [malhotra5/Manim-Tutorial] Chemistry figures in manim (#10)
I was trying to make molecules ,with manim, arraying polygons, lines and letters and it turn out to be a huge pain. Does someone know if it's possible to install a LaTex package (Chemfig) and use LaTex (the same way we use to generate equations) but to generate LaTex figures in manim ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub< https://github.com/malhotra5/Manim-Tutorial/issues/10?email_source=notifications&email_token=AF5X74IEUKBJ7HYYOONEXFTQJBBLHA5CNFSM4IVOD2SKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HKS26SA>, or mute the thread< https://github.com/notifications/unsubscribe-auth/AF5X74KXPEXZK2A5HL3QQ6TQJBBLHANCNFSM4IVOD2SA
.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/malhotra5/Manim-Tutorial/issues/10?email_source=notifications&email_token=ANE4YT5RU4MMPPUXLSUMROTQJDXPPA5CNFSM4IVOD2SKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6OPZFQ#issuecomment-530381974, or mute the thread https://github.com/notifications/unsubscribe-auth/ANE4YT5WYG7WD6IT5IWM4OTQJDXPPANCNFSM4IVOD2SA .
On Wed, Sep 11, 2019, 10:32 AM Travor Liu notifications@github.com wrote:
Hello, It is possible to install a LaTeX package and use them if you install manim from its source at https://github.com/3b1b/manim. After dumping your source to your computer, you can go to
/path/to/manim
and then open the filemanimlib/ctex_template.tex
. After opening the file, you can add\usepackage{...}
to import the packages.
From: Luis-Henrique655 notifications@github.com Sent: Wednesday, September 11, 2019 9:17 To: malhotra5/Manim-Tutorial Cc: Subscribed Subject: [malhotra5/Manim-Tutorial] Chemistry figures in manim (#10)
I was trying to make molecules ,with manim, arraying polygons, lines and letters and it turn out to be a huge pain. Does someone know if it's possible to install a LaTex package (Chemfig) and use LaTex (the same way we use to generate equations) but to generate LaTex figures in manim ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub< https://github.com/malhotra5/Manim-Tutorial/issues/10?email_source=notifications&email_token=AF5X74IEUKBJ7HYYOONEXFTQJBBLHA5CNFSM4IVOD2SKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HKS26SA>, or mute the thread< https://github.com/notifications/unsubscribe-auth/AF5X74KXPEXZK2A5HL3QQ6TQJBBLHANCNFSM4IVOD2SA
.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/malhotra5/Manim-Tutorial/issues/10?email_source=notifications&email_token=ANE4YT5RU4MMPPUXLSUMROTQJDXPPA5CNFSM4IVOD2SKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6OPZFQ#issuecomment-530381974, or mute the thread https://github.com/notifications/unsubscribe-auth/ANE4YT5WYG7WD6IT5IWM4OTQJDXPPANCNFSM4IVOD2SA .
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
Thanks for your help, I really appreciate it. As for the bonding problem, I don't really know what to do about this so I'll try to look for others similars packages and see if it works.
On Wed, Sep 11, 2019, 6:27 PM Travor Liu notifications@github.com wrote:
Well, there is a mistake to be corrected, also add the lines to
tex_template.tex
as well. You can reinstall using the following command:cd /path/to/manim python3 setup.py install
At last you need to use TextMobject instead of TexMobject since the latter one is only for math formula rendering. Inside the TexMobject you only need to specify "\chemfig{...}"
Travor Liu travor_lzh@outlook.com
On Sep 11, 2019, at 17:18, Luis-Henrique655 notifications@github.com wrote:
Hi, thank you very much for answering. I downloaded the package and added in ctex_template. Could you help me a little more? How to re-install this modified version ? And how to use the package inside the python code? Do I have to specify the package inside the TexMobject command ?
On Wed, Sep 11, 2019, 10:32 AM Travor Liu notifications@github.com wrote:
Hello, It is possible to install a LaTeX package and use them if you install manim from its source at https://github.com/3b1b/manim. After dumping your source to your computer, you can go to
/path/to/manim
and then open the filemanimlib/ctex_template.tex
. After opening the file, you can add\usepackage{...}
to import the packages.
From: Luis-Henrique655 notifications@github.com Sent: Wednesday, September 11, 2019 9:17 To: malhotra5/Manim-Tutorial Cc: Subscribed Subject: [malhotra5/Manim-Tutorial] Chemistry figures in manim (#10)
I was trying to make molecules ,with manim, arraying polygons, lines and letters and it turn out to be a huge pain. Does someone know if it's possible to install a LaTex package (Chemfig) and use LaTex (the same way we use to generate equations) but to generate LaTex figures in manim ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub<
or mute the thread<
https://github.com/notifications/unsubscribe-auth/AF5X74KXPEXZK2A5HL3QQ6TQJBBLHANCNFSM4IVOD2SA
.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/malhotra5/Manim-Tutorial/issues/10?email_source=notifications&email_token=ANE4YT5RU4MMPPUXLSUMROTQJDXPPA5CNFSM4IVOD2SKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6OPZFQ#issuecomment-530381974>,
or mute the thread < https://github.com/notifications/unsubscribe-auth/ANE4YT5WYG7WD6IT5IWM4OTQJDXPPANCNFSM4IVOD2SA>
.
On Wed, Sep 11, 2019, 10:32 AM Travor Liu notifications@github.com wrote:
Hello, It is possible to install a LaTeX package and use them if you install manim from its source at https://github.com/3b1b/manim. After dumping your source to your computer, you can go to
/path/to/manim
and then open the filemanimlib/ctex_template.tex
. After opening the file, you can add\usepackage{...}
to import the packages.
From: Luis-Henrique655 notifications@github.com Sent: Wednesday, September 11, 2019 9:17 To: malhotra5/Manim-Tutorial Cc: Subscribed Subject: [malhotra5/Manim-Tutorial] Chemistry figures in manim (#10)
I was trying to make molecules ,with manim, arraying polygons, lines and letters and it turn out to be a huge pain. Does someone know if it's possible to install a LaTex package (Chemfig) and use LaTex (the same way we use to generate equations) but to generate LaTex figures in manim ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub<
or mute the thread<
https://github.com/notifications/unsubscribe-auth/AF5X74KXPEXZK2A5HL3QQ6TQJBBLHANCNFSM4IVOD2SA
.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/malhotra5/Manim-Tutorial/issues/10?email_source=notifications&email_token=ANE4YT5RU4MMPPUXLSUMROTQJDXPPA5CNFSM4IVOD2SKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6OPZFQ#issuecomment-530381974>,
or mute the thread < https://github.com/notifications/unsubscribe-auth/ANE4YT5WYG7WD6IT5IWM4OTQJDXPPANCNFSM4IVOD2SA>
.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/malhotra5/Manim-Tutorial/issues/10?email_source=notifications&email_token=ANE4YT7WE4BT6GYRJ2M3BVLQJFPCJA5CNFSM4IVOD2SKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6P6NCA#issuecomment-530572936, or mute the thread https://github.com/notifications/unsubscribe-auth/ANE4YT43J7HQTCXNS7QW54TQJFPCJANCNFSM4IVOD2SA .
That is because the TextMobject class has a thickness of zero, and those symbols have no thickness, if you use the Write animation you can see they are drawn but disappear, to solve that you can do two things. If you want to use the chemfig package you will have to identify each symbol of the formula and give them a thickness:
class Chem(Scene):
def construct(self):
f1 = TextMobject(r"\chemfig{O=H}")
elements = self.show_index(f1[0])
self.add(elements)
f1[0][2:4].set_stroke(None,1,1)
self.play(Write(f1))
self.wait()
def show_index(self,mob,width=0.07):
n = VGroup()
for element,index in zip(mob,range(len(mob))):
i = Text(f"{index}",color=RED).set_width(width)
i.next_to(element,UP,buff=0)
n.add(i)
return n
Or, you can look for another chemical package whose symbols are shown by default, you can try this: https://tex.stackexchange.com/questions/52722/can-you-make-chemical-structure-diagrams-in-latex
I was trying to make molecules ,with manim, arraying polygons, lines and letters and it turn out to be a huge pain. Does someone know if it's possible to install a LaTex package (Chemfig) and use LaTex (the same way we use to generate equations) but to generate LaTex figures in manim ?