Skip to content
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

Added ability to remove non-svg LaTeX files #3322

Merged
merged 39 commits into from Nov 4, 2023

Conversation

JasonGrace2282
Copy link
Contributor

@JasonGrace2282 JasonGrace2282 commented Aug 9, 2023

Overview: What does this pull request change?

  • Made manim auto-remove non-tex and non-svg files by default. This behavior can be prevented with the CLI flag --no_latex_cleanup
  • Made manim check if an svg for a TeX expression already exists BEFORE creating .aux, .dvi, and other files.
    • This makes sure that even the user already has the svg for an expression and runs their code with --no_latex_cleanup, they will not get cluttered with the .aux, .dvi, and other files for that expression.

Motivation and Explanation: Why and how do your changes improve the library?

Often, for big manim projects, the media/Tex folder can get quite full with uneeded files. This PR gives users the option to have manim delete these files automatically, instead of having to manually delete said files.

Further Information and Comments

This will automatically delete ALL files without the .tex or .svg suffix in the media/Tex directory. It will only perform this if Tex or MathTex is used and the CLI flag --no_latex_cleanup has not been passed.

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring, including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

@JasonGrace2282 JasonGrace2282 changed the title Added ability to remove latex junk (default True) Added ability to remove non-svg LaTeX files Aug 9, 2023
@uwezi
Copy link
Contributor

uwezi commented Aug 9, 2023

I would not remove the .tex file itself. I don't know if it is needed for the caching algorithm, but anyway, it's quite useful for debugging.

@JasonGrace2282
Copy link
Contributor Author

JasonGrace2282 commented Aug 9, 2023

@uwezi I have modified the code to fit your suggestion :)

(For anyone looking at this [weird] commit history, I had a bunch of weird merge problems)

manim/scene/scene.py Fixed Show fixed Hide fixed
@JasonGrace2282
Copy link
Contributor Author

JasonGrace2282 commented Aug 10, 2023

I will move these changes from scene.py and scene_file_writer.py to tex_file_writing.py.

Copy link
Member

@behackl behackl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a bit more here to do; I've left some comments, please take a look. Thanks for your work!

manim/utils/tex_file_writing.py Outdated Show resolved Hide resolved
manim/utils/tex_file_writing.py Outdated Show resolved Hide resolved
manim/utils/tex_file_writing.py Outdated Show resolved Hide resolved
@behackl behackl added this to the v0.18.0 milestone Aug 11, 2023
manim/_config/utils.py Outdated Show resolved Hide resolved
manim/cli/render/global_options.py Outdated Show resolved Hide resolved
@behackl behackl enabled auto-merge (squash) November 4, 2023 13:26
@behackl behackl disabled auto-merge November 4, 2023 14:05
@behackl behackl merged commit 3962a12 into ManimCommunity:main Nov 4, 2023
17 of 18 checks passed
@JasonGrace2282 JasonGrace2282 deleted the latex_junk_remover branch November 8, 2023 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants