-
Notifications
You must be signed in to change notification settings - Fork 2.5k
completely rewrote the TeX template model #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This PR has been sent to 3b1b's repository a few months ago, but never got merged as (probably) Grant did not consider this useful to his own projects. It might be different in a community maintained version of manim that is used by many people in different situations. See 3b1b/manim#745 for discussion |
PgBiel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: I didn't analyze the code yet, just pointing out a few ideas that stand out
|
I don't think this is something to address immediately in this PR, but we should consider putting this somewhere other than constants.py. By definition, dynamically loading TeX templates is not constant. |
|
@PgBiel I added documentation and (hopefully) cleaned up the list of commits. Please do not hesitate to suggest further improvements, if necessary. |
|
@PhilippImhof you might want to add the parameters, their types and the return types of each function to the documentation. I'll then modify it to use our format for you |
PgBiel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few QoL suggestions
|
@PgBiel Thanks for those improvements. |
PgBiel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'll commit those bugs i left off
|
Shame on me, I didn't even see it.... Thanks |
|
I'm removing myself as a requested reviewer and requesting @yoshiask instead, since they seem to have thoughts about this PR. |
|
@yoshiask Certainly true. On the other hand, the TeX template will probably never ever be changed in the middle of an animation. Once initialized and set up, it will remain constant at least for one scene. (The only reason I can see for changing the template in between would be that one absolutely needs a certain package or definition in one scene, but cannot have it in the remainder of the animation because of a bad conflict.) |
|
Note that we also need to replace all |
|
Good point. I will have a look at this tomorrow. |
|
As nothing has happened for a few days, I wondered whether I could do anything to help in moving on? With the refactoring going on, merging will become more difficult. I think this PR would be useful for those who need additional packages (typically people who do not live in the US or other English speaking countries, like me) and it comes with no risk. |
|
@PhilippImhof thanks for the bump :) Just approved it. Now you need to take care of the merge conflicts. Please post here if you get stuck there (as quite a bit is happening on the repo these days). |
Thanks for approving the PR. I'm afraid I'm already stuck. I do not see the conflicts, I just see: "This branch has conflicts that must be resolved. Only those with write access to this repository can merge pull requests." Should I just pull the last version of ManimCommunity/master, rebase my branch, solve the conflicts locally and push another commit? (Rebasing is still somewhat difficult to me, it seems I still haven't come to a very deep understanding of this part of git.) |
An alternative is to directly try to pull ManimCommunity/master into your customtex branch, and resolve the conflicts. No rebasing necessary. Then push a new commit.
Same, rebases are scary :) |
|
Thanks @leotrs
I will try. Just to make sure: Won't this bring all those other commits into this PR again, like I had it at the very beginning? Also, won't this trigger another need for approvals? (What I mean: While waiting for new approvals, development in master goes on and new merge conflicts will probably appear.) |
|
If you are worried about all the commits, you can squash them! (Though I guess this will require a rebase...) In any case, as long as there are no conflicts between your branch and current master, I say don't worry about those commits. |
No |
|
Unfortunately, I am still stuck. I pulled the community's master, but for now, manim has stopped working. ( This happens even in a brand new directory populated with |
Have you run |
Yes, sorry for not mentioning it. I was just editing my comment when the notification of your question popped up... |
Have you checked if manim is present in your installed packages with |
|
Thanks for taking the time to help me.
|
Thats very strange indeed. How are you running manim in your scripts and in the command line? Importing manim in the file with |
That's exactly what I do. |
Do you have any other manim installations that might conflict with this? If you aren't able to solve it, it might be worth filing an issue... |
I suspect so, because if it was a problem in the repo, someone would have noticed way earlier. I will try to clean up the whole mess. It might be conflicting with the original 3b1b manim installation I had. Once I find out, I will post an update. |
|
Thanks, and sorry for the mess. When/if you get unstuck again, please post
here the full traceback and error message :)
…On Thu, May 28, 2020, 5:53 AM Philipp Imhof ***@***.***> wrote:
Do you have any other manim installations that might conflict with this?
If you aren't able to solve it, it might be worth filing an issue...
I suspect so, because if it was a problem in the repo, someone would have
noticed way earlier. I will try to clean up the whole mess. It might be
conflicting with the original 3b1b manim installation I had. Once I find
out, I will post an update.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#48 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAILYAHPRGQGETIZYMSHM73RTYYBVANCNFSM4NG2EEZQ>
.
|
|
So I got it all working again, by deleting all I also managed to resolve all conflicts, there have been quite a lot of changes. Now, before I push my changes to this PR, I just want to make sure not to blow things up: GitHub Desktop shows me 233 commits to push, which of course includes all the commits I pulled from master. Can I be sure that it will not cause any problems if I just push? (I tried squashing, but it resulted in strange conflicts.) |
|
Uhm wait, I guess you didn't push the latest commit yet, right? If that would imply the 233 commits, then I'd consult @eulertour. |
|
I am not sure of anything. But as I can only push to my own repository, they should be with respect to this one. However, I just do not know GitHub well enough to know, whether it is smart enough to leave them out in the PR. Correct, I did not push after resolving the merge, because I did not want to flood the PR with "unnecessary" commits. |
|
To be more precise:
up to
and then finally my last three commits
It is 249 lines, probably the 16 already in this PR plus the 233 to push (of which 230 are imported from here) |
|
You can prob try pushing to your branch and, if bad stuff happens, you can revert to the current state |
|
Finally.... |
|
It is all cleaned up now. I am sorry, but as a consequence, proper attribution of and credit for @PgBiel's improvements is gone. |

I have completely rewritten the code for managing the TeX template:
--tex_templateallows for a custom tex fileTeXTemplatestarting with the current default values for maximum backwards compatibility.register_tex_templateallows to register a new or modified templateExample
As you may have guessed, the syntax for packages is
append_package("package")if you do not have any optionsappend_package(["package",["option1","option2=value2"]])if you do have options to giveWhen using the command line approach with a custom template file, the simpler class
TeXTemplateFromFileis used. It does not allow adding/removing packages from within the scene. However, I do not think there is a need for it, because if one specifies a custom template file, we can surely assume they will not need to dynamically adapt it later on.