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 "tex_bin_dir" config option for specifying a custom TeX binarie… #3354

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

levimcgomes
Copy link

Overview: What does this pull request change?

  • Added new option tex_bin_dir to _config.utils.ManimConfig
  • Used this new option in tex_file_writing.py, to determine the location of both the TeX compiler and the dvisvgm executable
  • Updated manim/cli/checkhealth/checks.py to also use this option when determining the presence of LaTeX and dvisvgm

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

This new option allows users to specify a custom directory for the TeX executables, through the tex_bin_dir config, available both in config files and the CLI. When this option is unset, the executables which are found on the PATH will instead be used.

Having this option allows users to use Manim with a TeX installation which isn't on their PATH, which is usefull, for instance, when there are multiple TeX installations.

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

@@ -154,7 +155,10 @@ def is_ffmpeg_working():
),
)
def is_latex_available():
path_to_latex = shutil.which("latex")
if config.get_dir("tex_bin_dir") is not None:
path_to_latex = config.get_dir("tex_bin_dir") / "latex.exe"
Copy link
Author

Choose a reason for hiding this comment

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

I've tested this on Windows, and found the ".exe" suffix to be necessary. This might be different in other OS's though, in which case a simple if clause should solve it.

@behackl behackl added this to the v0.18.1 milestone Nov 12, 2023
@MrDiver
Copy link
Collaborator

MrDiver commented Dec 10, 2023

Wouldn't it be more useful to specify the binary directly in that case?

@MrDiver MrDiver marked this pull request as draft December 10, 2023 16:46
@levimcgomes
Copy link
Author

Perhaps. The reason I added an option for the folder instead of for the binary itself is because Manim is supposed to support different ways of rendering LaTeX, e.g. latex, xelatex and pdflatex (I say "supposed" because last time I tried (which was a long time ago though) this didn't really work).

@behackl behackl modified the milestones: v0.18.1, v0.19.0 Apr 23, 2024
@JasonGrace2282 JasonGrace2282 modified the milestones: v0.19.0, Refactor Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

4 participants