Fonts and fontspec for compiling latex documents in a docker container

Viewed 210

I'm using latex to compile a document but don't want to mess around with installing texlive on my machine again. To that end I've had great luck compiling documents with latex-in-a-docker-container. As a starting point I followed the directions at https://github.com/James-Yu/LaTeX-Workshop/wiki/Format#LaTeX-files using the tianon/latex:latest docker image. However, if I want to use fonts that are installed locally for my document, I run into problems. Some workarounds that I've had some luck with include 1) create a custom Docker image and install each font I may want, individually, e.g. by adding instructions for installing it to the Dockerfile 2) copy the font to my current directory and tell fontspec where to find it

Both of these seem sub-optimal. Ideally I would like to modify my docker run command (see, e.g., https://github.com/Arxisos/LaTex-Workshop-Docker/blob/master/bin/latexmk) so that all my system fonts are copied into the container's /usr/share/fonts directory (I believe this is where the system looks for them -- the Docker image is based on Debian; I'm looking at https://wiki.debian.org/Fonts). Is there a way to copy all the .otf and .tff files from /Users/MyUserName/Library/Fonts (if I'm on a Mac -- would be even better to have a solution that's not Mac-specific) to /usr/share/fonts?

0 Answers
Related