Created
January 28, 2020 17:27
-
-
Save ThabetAmer/7a6a60ad464d54922f803de7f6866523 to your computer and use it in GitHub Desktop.
Compile Latex files using docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Either to compile single file passed in args | |
# OR to go over all .tex files in directory - in batch mode. | |
# compile the tex file in arguments | |
[ -f "$1" ] && { docker run -i -w "/doc" -v "$PWD":/doc thomasweise/texlive xelatex -interaction=nonstopmode -halt-on-error $1; exit 0; } | |
# batch mode - compile all tex files | |
docker run -i -w "/doc" -v "$PWD":/doc thomasweise/texlive bash -c 'for file in $(find . -maxdepth 1 -name "*.tex"); do echo "Generating pdf for $file ..." && xelatex -interaction=batchmode -halt-on-error $file; done' | |
# cleanup | |
echo "Cleanup..." | |
rm -rf *.log *.aux *.out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment