Skip to content

Instantly share code, notes, and snippets.

@adujardin
Created April 26, 2017 10:08
Show Gist options
  • Save adujardin/320305075f728360df026691e565d5e7 to your computer and use it in GitHub Desktop.
Save adujardin/320305075f728360df026691e565d5e7 to your computer and use it in GitHub Desktop.
Latex document compilation using docker
#!/bin/sh
# Ressource: https://www.blang.io/posts/2015-04_docker-tooling-latex/
## Variables :
# https://hub.docker.com/r/fermiumlabs/latex-docker/
docker_img="fermiumlabs/latex-docker"
# The main file is named 'Main.tex'
main_doc="Main"
# This include full compilation (with bibtex)
launch_cmd_pdflatex="pdflatex ${main_doc}.tex"
launch_cmd_full="${launch_cmd_pdflatex} && bibtex ${main_doc} && ${launch_cmd_pdflatex} && ${launch_cmd_pdflatex}"
## Launching the compilation :
docker pull "${docker_img}:latest"
exec docker run --rm -i --user="$(id -u):$(id -g)" --net=none -v "$PWD":/data ${docker_img} "$@" /bin/sh -c "${launch_cmd_full}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment