0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Simple Docker image to convert Japanese Jupyter Notebook to PDF

Posted at

TL;DR

If you want to convert Jupyter Notebook (possibly, with Japanese script included) to pdf, do the following

  1. move to new directory
  2. inside it, create the subdirectories ./notebooks and ./pdfs
  3. save your notebook under the name ./notebooks/notebook.ipynb
  4. run the command docker run nailbiter/jupyter-latex-pdf
  5. pick up the generated pdf from ./pdfs/notebook.pdf

Purpose

In my work, I sometimes need to convert the Jupyter Notebook to PDF. While this is easy to do in general via jupyter nbconvert, if the Notebook contains Japanese script, experience shows,
that often the additional processing is required.

In my experience, the approach that works is to convert Notebook to tex file first, and then use XeTeX to create the PDF. However, this requires installing the number of big dependencies, most notably XeTeX and Japanese
fonts. In order to encapsulate these dependencies from contaminating the system, I have put up together simple Docker image, which does exactly that.

Codes

  1. Dockerfile
  2. image

References

While working on this post, I have used the data from the following sources:

  1. https://ysko909.github.io/posts/install-japanese-font-to-docker-cotainer/
  2. https://unix.stackexchange.com/questions/395694/can-i-automatically-accept-ms-sql-license-terms-while-installing-the-yum-package
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?