Skip to content

Commit

Permalink
binder: Install packages required for Jupyter to PDF convert (#714)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
yuvipanda and eitsupi committed Oct 20, 2023
1 parent c6152e1 commit cfc3942
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# News

## 2023-10

### Changes in pre-built images

- `rocker/binder` now includes necessary LaTeX packages to allow Jupyter Notebooks to be converted to PDF. ([#714](https://github.com/rocker-org/rocker-versioned2/pull/714))

### Changes in rocker_scripts

- `install_jupyter.sh` will now install TexLive if it is not installed, and add
additional LaTeX packages needed for Jupyter PDF conversion. This will increase
the build time and size of the final image in cases `install_jupyter.sh` is called.

## 2023-04

### Changes in pre-built images
Expand Down
13 changes: 13 additions & 0 deletions scripts/install_jupyter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ install2.r --error --skipmissing --skipinstalled -n "$NCPUS" remotes
R --quiet -e 'remotes::install_github("IRkernel/IRkernel@*release")'
R --quiet -e 'IRkernel::installspec(user = FALSE)'

# Install texlive if it has not already been installed
if ! command -v tlmgr; then
# shellcheck source=/dev/null
source /rocker_scripts/install_texlive.sh
fi

# Install tex packages needed for Jupyter's nbconvert to work correctly & convert to PDF
# Sourced from https://github.com/jupyter/nbconvert/issues/1328
tlmgr install adjustbox caption collectbox enumitem environ eurosym etoolbox jknapltx parskip \
pdfcol pgf rsfs tcolorbox titling trimspaces ucs ulem upquote \
ltxcmds infwarerr iftex kvoptions kvsetkeys float geometry amsmath fontspec \
unicode-math fancyvrb grffile hyperref booktabs soul ec

# Clean up
rm -rf /var/lib/apt/lists/*
rm -rf /tmp/downloaded_packages
Expand Down

0 comments on commit cfc3942

Please sign in to comment.