-
Notifications
You must be signed in to change notification settings - Fork 559
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
Minimum Tex package install for converting Jupyter notebooks to PDFs #1328
Comments
We don't install LaTeX automatically as a dependency since is it so large, and many users have their own preferences. I personally use MikTeX because I like the on-the-fly package installation. However, I would absolutely welcome a PR updating our documentation here: https://github.com/jupyter/nbconvert/blob/master/docs/source/install.rst for how to install LaTeX using TinyTex. There is not a minimum spec listed. You'd have to look directly at the different templates to find them all, and it is subject to change. For example, the |
I guess an actionable point here is to have a complete list of TeX packages required. |
Here's the minimum list needed now:
I wrote this janky script to help me: import sys
import subprocess
outfile = open("packages", "a")
while True:
convert = subprocess.run(["jupyter", "nbconvert", "--to", "pdf", "Untitled.ipynb"], capture_output=True)
if convert.returncode == 0:
break
print(convert.stdout)
print(convert.stderr)
for l in convert.stderr.decode().split("\n"):
if not l.startswith('! LaTeX Error: File'):
continue
missing = l.split(' ')[4]
missing = missing.strip("'").strip("`")
missing = missing.split(".")[0]
outfile.write(f"{missing}\n")
subprocess.check_call(["tlmgr", "install", missing]) It won't work for everything (it didn't catch |
Per jupyter/nbconvert#1328, these are the packages needed for Jupyter to be able to convert to PDF. Without it, you get unfriendly errors like [this] (2i2c-org/infrastructure#3188 (comment)). Given that the binder image includes jupyter, and texlive is included in the base, I hope it would be reasonable for the binder image to include enough texlive packages for PDF conversion to work. Otherwise, it works in RStudio but not in Jupyter.
Per jupyter/nbconvert#1328, these are the packages needed for Jupyter to be able to convert to PDF. Without it, you get unfriendly errors like [this] (2i2c-org/infrastructure#3188 (comment)). Given that the binder image includes jupyter, and texlive is included in the base, I hope it would be reasonable for the binder image to include enough texlive packages for PDF conversion to work. Otherwise, it works in RStudio but not in Jupyter.
Per jupyter/nbconvert#1328, these are the packages needed for Jupyter to be able to convert to PDF. Without it, you get unfriendly errors like [this] (2i2c-org/infrastructure#3188 (comment)). Given that the binder image includes jupyter, and texlive is included in the base, I hope it would be reasonable for the binder image to include enough texlive packages for PDF conversion to work. Otherwise, it works in RStudio but not in Jupyter.
Per jupyter/nbconvert#1328, these are the packages needed for Jupyter to be able to convert to PDF. Without it, you get unfriendly errors like [this] (2i2c-org/infrastructure#3188 (comment)). Given that the binder image includes jupyter, and texlive is included in the base, I hope it would be reasonable for the binder image to include enough texlive packages for PDF conversion to work. Otherwise, it works in RStudio but not in Jupyter. --------- Co-authored-by: eitsupi <50911393+eitsupi@users.noreply.github.com>
My students and I are constantly going back and forth between R & Python, and Jupyter and RStudio for our work. We have found that there is an excellent project, TinyTex that gives enough TeX packages to render from
.md
/.Rmd
to.pdf
and is only 150Mb in size! This serves us very well in our RStudio work, and I have started to use this with Jupyter as well. However, there are ~ 16 additional packages that I have found needed for this to work, in addition to the TinyTex base install (listed below).Here, in the TinyTex repo, I am suggesting that I will submit a PR to create a helper function/file to make these 16 additional packages easy to install. However, before I do this, the TinyTex team and myself want to know if somewhere there already exists a minimum set of required TeX packages to render a Jupyter notebook to PDF?
Also, once we incorporate this PR into TinyTex, perhaps
nbconvert
might want to consider using the TinyTex install for Tex packages for CI instead of installing all of Tex Live? Just an idea I thought I would toss out.Packages that need to be installed in addition to TinyTex for it to work with Jupyter:
The text was updated successfully, but these errors were encountered: